How can I determine whether a given number N is a fibonacci number or not, if that number is not a fibonacci number how can I*determine the largest fibonacci number smaller than N?
I found the solution via generating the series of fibonacci number with limit N.
Is there any better way to do this in Python?
guys consider while DOWN VOTES, I’ve accepted the solution provided here. I do not think it as worthwhile since I have posted what I need and got the solution from you guys.
Thank You.
A simple test for whether some integer
Nis a Fibonacci number is as follows:See here for the ingenious proof (page 417): http://www.fq.math.ca/Scanned/10-4/advanced10-4.pdf
If it turns out that
Nis not a Fibonacci number, then the simplest method is just to keep trying with smaller numbers until you find one, although this could take a very long time for largeN.