<div dir="ltr">I have some code that checks to see if a number is a fibonacci number. It's not mine, I got it from somewhere and I need to credit it. I am pretty sure I got it from Stack Exchange but my search for it went nowhere. If this looks familiar to you, or you can tell me better ways to search, please let me know.<br><br>isFib :: Integer -> Bool<br>isFib n = n == a where (_, a, _) = unFib (1, 1) n<br><br>unFib :: (Integer, Integer) -> Integer -> (Integer,Integer,Integer)<br>unFib (a, b) n<br>  | n < a = (0, 0, 1)<br>  | n < e = (2*k, c, d)<br>  | otherwise = (2*k + 1, e, f)<br>      where<br>        (k, c, d) = unFib (fibPlus (a, b) (a, b)) n<br>        (e, f)    = fibPlus (a, b) (c, d)<br><br>fibPlus :: (Integer, Integer) -> (Integer, Integer) -> (Integer,Integer)<br>fibPlus (a, b) (c, d) = (bd - (b - a)*(d - c), a*c + bd)<br>  where bd = b*d<br></div>