You are viewing a single comment's thread. Return to all comments →
from math import log10 as log from math import sqrt def num_of_digits(n): if n == 1: return 1 a = log((1 + sqrt(5))/2) b = ((log(5)) / 2) return(int((n+b-1)/a) + 1) # print(num_of_digits(5)) T = int(input()) for a0 in range(T): N = int(input()) print(num_of_digits(N))
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #25: N-digit Fibonacci number
You are viewing a single comment's thread. Return to all comments →