Problem 25
生活随笔
收集整理的這篇文章主要介紹了
Problem 25
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Problem 25
The Fibonacci sequence is defined by the recurrence relation:Fn = Fn?1 + Fn?2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 = 34
F10 = 55
F11 = 89
F12 = 144
The 12th term, F12, is the first term to contain three digits.
What is the index of the first term in the Fibonacci sequence to contain 1000 digits?
第一個包含1000位數的斐波那契數的索引是什么?
fibonacci = [] x, y = 1, 1 index = 1 while not len(str(x)) == 1000:index += 1fibonacci.append(x)x,y = y, x+y print(index)
?
轉載于:https://www.cnblogs.com/noonjuan/p/10963626.html
新人創作打卡挑戰賽發博客就能抽獎!定制產品紅包拿不停!總結
以上是生活随笔為你收集整理的Problem 25的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: webServlet(/) 和 webS
- 下一篇: OC 应用跳转QQ私聊界面或者申请加群