(12C) Check if given number is Fibonacci number
|
09-04-2018, 02:00 PM
Post: #2
|
|||
|
|||
RE: (12C) Check if given number is Fibonacci number
Nice formula:
If (5 x^2 +/- 4) is perfect square, x is Fibonacci number. However, there is a weakness if done on the HP-12C. For x > 44721, the expression overflow 10-digits. Rounding errors kill the algorithm. So, above code has a safe domain upto 44721 (only 23 Fibonacci numbers in that range) It might be better to generate the Fibonacci numbers directly, and test the input. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(12C) Check if given number is Fibonacci number - Gamo - 09-04-2018, 11:58 AM
RE: (12C) Check if given number is Fibonacci number - Albert Chan - 09-04-2018 02:00 PM
RE: (12C) Check if given number is Fibonacci number - Gamo - 09-04-2018, 02:25 PM
RE: (12C) Check if given number is Fibonacci number - stored - 09-07-2018, 03:19 PM
RE: (12C) Check if given number is Fibonacci number - Albert Chan - 09-07-2018, 07:33 PM
RE: (12C) Check if given number is Fibonacci number - stored - 09-08-2018, 06:48 PM
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)