You are viewing a single comment's thread. Return to all comments →
Two test caser are running other showing time problem can anyone fix it
import math def getPeriod(x): root=int(math.sqrt(x)) if(root*root==x): return 0 a=root num=0 den=1 per=0 while(a!=2*root): num=den*a-num den=(x-num**2)/den a=(root+num)/den per+=1 return per last=int(input()) numOdd=0 for i in range(2,last): per=getPeriod(i) if(per%2==1): numOdd+=1 print(math.ceil(numOdd)+1)
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #64: Odd period square roots
You are viewing a single comment's thread. Return to all comments →
Two test caser are running other showing time problem can anyone fix it