-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path25.py
More file actions
34 lines (27 loc) · 652 Bytes
/
25.py
File metadata and controls
34 lines (27 loc) · 652 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
# Advances the Fibonacci sequence until it reaches the first term with 1000 digits.
"""Project Euler Problem 25: https://projecteuler.net/problem=25"""
from datetime import date, timedelta
from collections import defaultdict
sz = 28123
num = []
import sympy
f1 = 1
f2 = 1
sz = 1000000000000000000000000000000000000000000000000
prev = 1
cntr = 2
idx = 2
while True:
f1, f2 = f2, f1 + f2
# print(f2)
# if len(str(f2)) != prev:
# print(cntr, f1, f2)
# prev = len(str(f2))
# cntr = 1
# else:
# cntr += 1
idx += 1
if len(str(f2)) >= 1000:
print(idx)
break