You can calculate phi to arbitrary precision in J.

[Mailer may break long lines below.]

NB. From J Phrases
sqrt=:4 : '-:@(+y.&%)^:(>.2^.1>.x.-16) x:%:y.'

NB. phi y gives phi correct to y digits
phi=:13 : '-:>: y. sqrt 5'
NB. Following copied from reference
phibook=:'1.61803398874989484820458683436563811772030917980576286213544862270526046281890'
phij=:0j77": phi 78

   phij
1.61803398874989484820458683436563811772030917980576286213544862270526046281890
   phibook
1.61803398874989484820458683436563811772030917980576286213544862270526046281890

Best wishes,

John

p j wrote:
> Bill,
> thanks I guess... using phi seems to get the "right"
> answers for first few digits of k up to 100000 not 76,
> but I can see how that would explain it breaking for
> high k.  Using phi of 80 digits or so (first row from
> page below), made my formula accurate enough to get
> right numbers for k>300000
>
> http://www.worldwideschool.org/library/books/sci/math/MiscellaneousMathematicalConstants/chap46.html
>
> Roger,
>
> It was easy to miss but the results produce useful
> notation after you set the global print precision to
>
> 9!:11 (15)
>
>>>
> I can not relate your statement
>
>    the above formula produces the first few digits of
> the
>    kth fibonacci number.
>
> with the following result:
>
>    fibfirst i.4 5
> 4.47214e10 7.23607e10 1.17082e10 1.89443e10 3.06525e10
>
> ----
>
>
> fibfirst=: 3 : 0
> p=. 1.61803398874991595753 NB. -: >: ( %: 5)
> a =. ((y.) * (10^. p)) - 10^.2.2360679774997898
> a =. 10 + a - (<. a)
> 10^a
> )
>
> the above formula produces the first few digits of the
> kth fibonacci number.
>
> the following list are offsets from 300000 that
> produce fibonacci numbers with digits 1-9 pandigital.
> (302079, 303585 etc...)
> 2079 3585 4120 4651 5079 9027 12850 16912 22309 22658
> 22723 24531 32770 33578 33851 34494 35588 36987 38128
> 41512 43091 43387 51186 57068 57512 59737 59766 70611
> 71824 83432 95911 97945
>
> according to this site,
> http://www.mcs.surrey.ac.uk/Personal/R.Knott/Fibonacci/fibFormula.html#LOG
>
> Most of these numbers are actually not pandigital.
> My formula is higher by 1-4 on the first 9 digits.  Is
> this because I have chosen different precision for
> phi?
> If so, this would be weird because my phi number (p)
> is smaller than the rounding choices at that web site
> (so I would expect my numbers would be smaller).
>
> Is there some internal rounding in J that could create
> the discrepency?
>
>
>
>
>
>
> __________________________________________________________
> Find your next car at http://autos.yahoo.ca
> ----------------------------------------------------------------------
> 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