python斐波那契数列前50
时间: 2023-06-09 14:02:41 浏览: 260
个数字是多少?
斐波那契数列是指从第三个开始,每个数都是前两个数之和的数列。前50个数字如下:0, 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, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170, 1836311903, 2971215073, 4807526976, 7778742049.
相关问题
python斐波那契数列前50项
Sure! Python code for generating the first 50 terms of the Fibonacci sequence is:
fibonacci = [0, 1]
for i in range(2, 50):
fibonacci.append(fibonacci[i-1] + fibonacci[i-2])
print(fibonacci)
Hope that helps!
python斐波那契数列前20项
以下是 Python 实现的斐波那契数列前 20 项:
```python
a, b = 0, 1
for i in range(20):
print(a, end=" ")
a, b = b, a + b
```
输出结果为:
```
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181
```
阅读全文