Good one.
NB. rule: 1->2, 2->1 2
Fib =: (#~0&<)@(,/@:({&(>2;1 2)))&:<:^:
fib1=: -.&0@,@:({&(3 2$0 0 2 0 1 2))^:
fib2=: ;@({&('';2;1 2))^:
fib1 and fib2 are shorter equivalents to Fib .
NB. rule 0->1 ; 1->0 1
fib3=: 3 : '+/;@({&(1;0 1))^:y 0' " 0
fib3 i.2 10
0 1 1 2 3 5 8 13 21 34
55 89 144 233 377 610 987 1597 2584 4181
----- Original Message -----
From: Viktor Cerovski <[email protected]>
Date: Wednesday, May 20, 2009 16:13
Subject: Re: [Jchat] Silver ratio, geometrically interpreted
To: [email protected]
>
>
> Tracy Harms-3 wrote:
> >
> > A nice bit of illustrated commentary on a special number we
> don't tend
> > to hear a lot about:
> >
> > http://maxwelldemon.wordpress.com/2009/05/20/unscheduled-post-
> the-silver-ratio/
> >
> Both golden (Fibonacci) and silver (octonacci) numbers can be
> obtained from
> substitution rules applied to sequences of a two-letter
> alphabet. For
> instance:
>
> Fib=:(#~ 0&<)@(,/@:({&(>2;1 2)))&:<:^:
> NB. rule: 1->2, 2->12
> 7 Fib 1
> 2 1 2 1 2 2 1 2 1 2 2 1 2 2 1 2 1 2 2 1 2
> +/ 2 = 7 Fib 1
> 13
> +/ 2 = 10 Fib 1
> 55
> fib =: 3 : '+/2=(y-1)Fib 1'
>
> I think that fib is not mentioned in the Roger's essay on
> generating the Fibonacci's sequence.
>
> Octonacci chains can be defined similarly as:
>
> Oct=:(#~ 0&<)@(,/@:({&(>2;2 1 2)))&:<:^:
>
> 3 Oct 2 1
> 2 1 2 2 2 1 2 2 1 2 2 1 2 2 2 1 2 2 1 2 2 2 1 2
>
> Such chains have many interesting properties...
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm