Pell numbers: Difference between revisions

Content added Content deleted
(→‎{{header|J}}: incorrect. √2 not 1/√2)
(→‎{{header|J}}: bugfix (... my focus is far too narrow when I forget to double check against the english description))
Line 95: Line 95:


=={{header|J}}==
=={{header|J}}==
{{incorrect|J|√2 is 1.41421... not 0.707107... Seems to be calculating the recipricol 1/√2, which is interesting, but not what the task asks for.}}
As detailed in the task description, there's a variety of ways to compute these values.
As detailed in the task description, there's a variety of ways to compute these values.


Line 128: Line 127:


Continuing... the first ten rational approximations to √2 here would be:
Continuing... the first ten rational approximations to √2 here would be:
<lang J> }.(% _1}. +//.@,:~) nextPell^:9(0 1)
<lang J> }.(%~ _1}. +//.@,:~) nextPell^:9(0 1)
1 0.666667 0.714286 0.705882 0.707317 0.707071 0.707113 0.707106 0.707107 0.707107
1 1.5 1.4 1.41667 1.41379 1.41429 1.4142 1.41422 1.41421 1.41421
}.(% _1}. +//.@,:~) nextPell^:9(0 1x)
}.(%~ _1}. +//.@,:~) nextPell^:9(0 1x)
1 2r3 5r7 12r17 29r41 70r99 169r239 408r577 985r1393 2378r3363</lang>
1 3r2 7r5 17r12 41r29 99r70 239r169 577r408 1393r985 3363r2378</lang>


The first ten pell primes are:
The first ten pell primes are: