Fibonacci number
/ * Fibonacci numbers are listed: the first two, as the third and the first two, 1 + 1 = 2 fourth is 2 + 1 = 3 and the front two of the fifth item is a front two of and 3 + 2 = 5 . 1. 5. 1 2 3. 8 .... 13 is 21 is 34 is 55 * /
Recursive evaluation of the number of N items that Fibonacci sequence Fibonacci
1 // Use the Fibonacci recursion N key value column 2 Package main . 3 . 4 Import " FMT " . 5 . 6 FUNC main () { . 7 fmt.Println ( " by the Fibonacci columns, computing power test the numbers do not move, close the window itself. " ) . 8 for I: = 0 ; I < 10000 ; I ++ { . 9 fmt.Printf ( " first position% v, atoms% v \ n- " , I, GetFibonacci (I )) 10 } . 11 } 12 is 13 is FUNC GetFibonacci (n- int ) int { 14 15 // return back 16 IF n-== 0 || n-== . 1 { . 17 return . 1 18 is } . 19 20 is // way handed down 21 is return GetFibonacci (N- . 1 ) + GetFibonacci (N- 2 ) 22 is } 23 is / * 24 by Fibonacci columns, test computing power, numbers do not move, close the window itself. 25 0 position, a number 26 is a first position, number 1 27 second position, number 2 28 3 position, is 3 29 4 position, number 5 30 5 position, is 8 31 is 6 position, the number is 13 32 position 7, the number 21 33 is position 8, the number 34 34 is the 9th position, the number is 55 35 10th position, the number of 89 36 of 11 positions, the number 144 37 [ 12 position, the number 233 38 is the first position 13, the number 377 39 14 position, the number 610 40 15 position, the number 987 41 is the 16th position, number 1597 42 is the 17th position, the number of 2584 43 is the 18th position, number 4181 44 is 19 position, number 6765 45 20 position, number 10946 46 is position 21, number 17711 47 22 position, number 28657 48 23 position, number 46368 49 24 position, number 75025 50 25 position, number 121 393 51 is the 26th position, number 196 418 52 is the 27th position, number 317 811 53 is position 28, number 514 229 54 is the first position 29, number 832 040 55 30 position, number 1346269 56 is 31 location, number 2178309 57 is 32 position, number 3524578 58 33 position, number 5702887 59 34th position, number 9,227,465 60 35th position, number 14,930,352 61 is the 36th position, number 24,157,817 62 is 37 position, number 39,088,169 63 is the first position 38, the number is 63,245,986 64 39 position, number 102 334 155 65 40 position, number 165 580 141 66 41 position, number 267 914 296 67 42 position, number 433494437 68 43 position, number 701 408 733 69 44 position, number 1134903170 70 in position 45, the number of 1,836,311,903 71 is * /