Fibonacci columns --Python achieve

 
 
# Function: seeking Fibonacci number number of values ​​of n
# In this setting n- 
n-30 = Print ( ' \ n- ' ); Print ( ' n-= ' , n-)
# Code generation Fibonacci sequence, stored in the array A 
A = [0] * n- 
A [0] =. 1; A [. 1] =. 1
 for I in Range (2 , n-): 
    A [I] = A [I-. 1 ] + a [I-2 ]
 Print ( ' \ n first n Fibonacci number as that number Qi: ' ); Print (a)
 Print ( ' \ n Fibonacci number is the n-th number: ' , A [n--. 1 ]);
 Print ( ' \ n- ' )

# operation result

n = 30 

Fibonacci number that the number n of strata as before: 
[ 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040 ] 

Fibonacci number is the n-th number: 832040

 

 
 

Guess you like

Origin www.cnblogs.com/aiyou-3344520/p/12128031.html