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
4.95967e10 8.02492e10 1.29846e10 2.10095e10 3.39941e10
5.50036e10 8.89978e10 1.44001e10 2.32999e10 3.77001e10
6.1e10 9.87e10 1.597e10 2.584e10 4.181e10
----- Original Message -----
From: "p j" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, February 20, 2006 6:35 PM
Subject: [Jprogramming] bug with numeric precision?
I've been trying to get prob 104 done
http://mathschallenge.net/index.php?section=project&ref=problems&id=104
with 9!:11 (15),
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?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm