Fibonacci

fibonacci_avatar

F_{1} =F_{2} =1; \; F_{n+2} = F_{n+1} + F_{n} ; \; \lim \limits_{ n \rightarrow \infty } \frac{ F_{n+1} }{ F_{n} } = \Phi \approxeq 1.61803... ;

F_{n} = \frac{1}{ \sqrt{5} } \cdot ( { \Phi }^n - ( 1- \Phi )^n ) ;

\sum \limits_{i=1}^{n} F_{i} = F_{n+2} - 1 ; \; \sum \limits_{i=1}^{n} { F_{i} }^2 = F_{n} \cdot F_{n+1} ;

F_{n+k} = F_{k} \cdot F_{n+1} + F_{k-1} \cdot F_{n} \; \; \; F_{2n} = F_{n} \cdot F_{n+1} + F_{n-1} \cdot F_{n}

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

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: