This way of constructing what is known as the rabbit sequence, I already
gave in
http://www.jsoftware.com/pipermail/programming/2007-December/009177.html,
including repeated squaring:


   ts'([:; (;@:{&.><)^:(]`(0 1;~1:)))5'
0.19197681 2.3489024e8

   (f9seq 34)-:([:; (;@:{&.><)^:(]`(0 1;~1:)))5
1

   ts 'f9seq 34'         NB. f9seq from
http://www.jsoftware.com/jwiki/Essays/Fibonacci%20Sequence#RewriteRules 
0.7917748 92279552


Before that the elegant solution (,#;._1)^:(]`1:) was given in
http://www.jsoftware.com/pipermail/programming/2007-November/008780.html 

   ts'|.(,#;._1)^:(]`1:)33'
0.64488748 2.6844032e8

   (|.(,#;._1)^:(]`1:)33)-:([:; (;@:{&.><)^:(]`(0 1;~1:)))5
1
   

R.E. Boss



> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:[email protected]] Namens
> Roger Hui
> Verzonden: donderdag 21 mei 2009 1:46
> Aan: Chat forum
> Onderwerp: Re: [Jchat] Silver ratio, geometrically interpreted
> 
> 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

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

Reply via email to