Skip to content
Prev 257648 / 398502 Next

Fibonacci

If you are going to round anyway, you can save time and
add puzzlement by leaving out the (1-phi)^n term:
  
  > fib3 <- function(n) {round( (phi ^ n) / sqrt(5) ) }
  > all(fib2(0:100) == fib3(0:100))
  [1] TRUE

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com