Project Euler/25

From Esolang
Jump to navigation Jump to search

Back to User:ProjectEuler

Project Euler Problem 25 is a problem related to Fibonacci numbers. It requires you to find the index of the smallest Fibonacci number with 1000 digits, where F[1] = F[2] = 1

This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Implementations

Python

By User:None1.

a,b=1,1
while len(str(a))<1000:a,b=b,a+b
print(a)

Notice: The implementation above is incorrect. It was created for an earlier, mis-written problem.

Fixed by User:GUAqwq.

a,b,i = 1,1,2
while len(str(b))<1000:
    a,b,i = b,a+b,i+1
print(i)

Pyline

By User:GUAqwq.

(l:=[1,1],[l:=l+[l[-1]+l[-2]]for i in iter(lambda:len(str(l[-1]))<1000,0)],print(len(l)))