is_from_fibonacci_sequence

is_from_fibonacci_sequence#

mrinufft.trajectories.maths.is_from_fibonacci_sequence(n)[source]#

Check if an integer belongs to the Fibonacci sequence.

An integer belongs to the Fibonacci sequence if either \(5*n²+4\) or \(5*n²-4\) is a perfect square (Wikipedia).

Parameters:

n (int) – Integer to check.

Returns:

Whether or not n belongs to the Fibonacci sequence.

Return type:

bool