Dan Bron schreef:
> Here's another fun way:
>
>          zUr9  =:  ([: ; <@#:@>:)^:(|.1 0"_`])
>       
>          zUr9 5
>       1 0 1 1 0 1 0 1 1 0 1 1 0 1 0 1 1 0 1 0 1
>          
>          (zUr 10) -: 18 {. zUr9 5
>       1
>          
> Unfortunately, as you can see, it isn't functionally identical to the other 
> zUr   .  Whereas the other verbs grow by at most two elements each
> iteration,  zUr9  grows as the Fibonacci sequence:
>
>          [EMAIL PROTECTED]"0 i. 10
>       2 3 5 8 13 21 34 55 89 144
   x:@[EMAIL PROTECTED]"0 i.7
2 5 22 181 5814 1488565 12194330294

Great. This is identical with the recurrence relation:
(leave out the first two)

rabS=:(([:$:_1+]),[:$:_2+])^:(1<])

   x:#.rabS"0 i.9
0 1 2 5 22 181 5814 1488565 12194330294


=@@i


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to