Skip to content

Instantly share code, notes, and snippets.

@samrat
Created October 8, 2012 05:47
Show Gist options
  • Save samrat/3850914 to your computer and use it in GitHub Desktop.
Save samrat/3850914 to your computer and use it in GitHub Desktop.
Fibonacci numbers with the golden ratio
(define golden-ratio (/ (+ 1 (sqrt 5)) 2))
(define (fib n)
(inexact->exact (round (/ (expt golden-ratio n) (sqrt 5)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment