Created
October 8, 2012 05:47
-
-
Save samrat/3850914 to your computer and use it in GitHub Desktop.
Fibonacci numbers with the golden ratio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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