Home
> Numbers, Number Theory, Series > Fibonacci

## Fibonacci

Ruby code for Fibonacci numbers:

def fibo(n)

phi = ( Math.sqrt(5) + 1 )/2

pho = 1 - phi

if n > -1

Integer( ( phi**n - pho**n )/( Math.sqrt(5) ) )

else

Integer( ( (-1)**(n+1) )*fibo(-n) )

end

end

to be continued

###### Related articles

- Fibonacci in nature – patterns around us (dailypaul.com)
- Fibonacci (raspberry-python.blogspot.com)
- Script For Efficient High Fibonacci Number Calculation (scientificocean.wordpress.com)

Comments (0)
Trackbacks (0)
Leave a comment
Trackback