A very nice test is that N is a Fibonacci number if and only if 5 N^2 + 4
or 5N^2 – 4
is a square number. For ideas on how to efficiently test that a number is square refer to the SO discussion.
A very nice test is that N is a Fibonacci number if and only if 5 N^2 + 4
or 5N^2 – 4
is a square number. For ideas on how to efficiently test that a number is square refer to the SO discussion.