Post Reply 
(12C) Check if given number is Fibonacci number
09-09-2018, 12:14 AM (This post was last modified: 09-09-2018 01:35 AM by Albert Chan.)
Post: #7
RE: (12C) Check if given number is Fibonacci number
Hi, stored

To extend your algorithm for full ten digits (your code take care of eight), I use Binet formula.
Instead of guessing n from X, do it in reverse, with HP12C correction to match actual Fib(n):

X = phi^n / sqrt(5)
X = X - X * 7.7e-9
X = INT(X + 0.5)

For n>40, if your code think the number may be Fibonacci, above can check it.
note: eps = 2e-8 may cover this range, but need actual confirmation.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (12C) Check if given number is Fibonacci number - Albert Chan - 09-09-2018 12:14 AM



User(s) browsing this thread: 1 Guest(s)