MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Quick Mathematica Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115272] Re: Quick Mathematica Question
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Thu, 6 Jan 2011 02:03:36 -0500 (EST)

For example:

rules = {0 -> 1, 1 -> Sequence[1, 0]};
step = # /. rules &;

evolution = NestList[step, {0}, 5];

FromDigits /@ evolution

{0, 1, 10, 101, 10110, 10110101}

Bobby

On Wed, 05 Jan 2011 04:46:50 -0600, Dean <deanrosenthal at gmail.com> wrote:

> How would I program user-defined rules such as
>
> 0->1
> 1->10
>
> to give the output, and specify the number of recursions.  For example,
> starting with 0,
>
> 0
> 1
> 10
> 101
> 10110
> ...
>
> Specified, 5 generations.
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: FillingStyle -> Striped ?
  • Next by Date: Re: Quick Mathematica Question
  • Previous by thread: Re: Quick Mathematica Question
  • Next by thread: Re: Quick Mathematica Question