The Rabbit Sequence:
1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,0,...
This nasty acquaintance of mine asked the students to write down a simple
procedure which generates the sequence after the infinite number of units
of time. Of course, any finite prefix of it.
In
It's not over yet, the rabbits are still going strong on the fibonacci-side.
Jerzy Karczmarczuk wrote:
the solution of Alfonso Acosta:
rs_aa = let acum a1 a2 = a2 ++ acum (a1++a2) a1 in 1 : acum [1] [0]
We can apply the difference list trick to obtain
f 0 = (0:)
f 1 = (1:)
f n = f