You are viewing a single comment's thread. Return to all comments →
from fractions import Fraction n = int(input().strip()) dec = [0,Fraction(1,2)] for i in range(2,n+1): temp1 = Fraction(1,2+dec[i-1]) dec.append(temp1) temp2 = Fraction(1,1) temp3 = temp2+temp1 nume = temp3.numerator deno = temp3.denominator if len(str(nume))>len(str(deno)): print(i)
It seems a little easy, attached codes for your kind reference.
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #57: Square root convergents
You are viewing a single comment's thread. Return to all comments →
It seems a little easy, attached codes for your kind reference.