Note that all of these break at some point due to the limited precision of sqrt 5, it's not that noticable on the languages that don't provide bignum Haskell: let phi = ((sqrt 5) + 1) / 2 let fib n = round ((phi ** n) / (sqrt 5)) scheme: (define phi (/ (+ 1 (sqrt 5)) 2)) (define (fib n) (inexact->exact (round (/ (expt phi n) (sqrt 5))))) common lisp: (defvar phi (/ (+ 1 (sqrt 5)) 2)) (defun fib (n) (round (/ (expt phi n) (sqrt 5)))) ocaml: (* note: fib 44 max *) let round n = if (n -. (floor n) > 0.5) then ceil n else floor n;; let phi = ((sqrt 5.0) +. 1.0) /. 2.0;; let fib n = int_of_float (round ((phi ** float_of_int n) /. sqrt 5.0));; clean: // note fib 46 max module test import StdEnv import StdReal pow x n | n==0.0 = 1.0 = pow x (n-1.0) * x round n | n - (toReal (toInt n)) > 0.5 = (toInt n) + 1 = toInt n phi = ((sqrt 5.0) + 1.0) / 2.0 fib n = round ((pow phi (toReal n)) / (sqrt 5.0)) Start = fib 30 python: from math import sqrt from math import pow def fib(n): return int(round(pow(((sqrt(5) + 1) / 2), n) / (sqrt(5))))