[Jprogramming] Rabbit sequence
R.E. Boss
r.e.boss at planet.nl
Fri Dec 21 22:33:06 HKT 2007
In http://www.jsoftware.com/pipermail/programming/2007-November/008780.html
a concise version for the rabbit sequence
http://www.research.att.com/~njas/sequences/A005203 was given:
(,#;._1)^:(]`1:)
x:@#.@: ((,#;._1)^:(]`1:))"0 i.9
1 2 5 22 181 5814 1488565 12194330294 25573364166211252
A nice example of repeated squaring is applicable here:
[:;@|. (;@:{&.><)^:(]`(1 0;~1:))
#@([:;@|. (;@:{&.><)^:(]`(1 0;~1:)))"0 i.6
3 5 13 89 4181 9227465
#@((,#;._1)^:(]`1:))"0 [2 3 5 9 17 33
3 5 13 89 4181 9227465
(([:;@|. (;@:{&.><)^:(]`(1 0;~1:)))5) -: (,#;._1)^:(]`1:)33
1
5 ts'(,#;._1)^:(]`1:)33'
0.40119768 1.1744294e8
5 ts'([:;@|. (;@:{&.><)^:(]`(1 0;~1:)))5'
0.085593824 1.1744531e8
R.E. Boss
More information about the Programming
mailing list