Project Euler #171: Finding numbers for which the sum of the squares of the digits is a square

  • + 0 comments

    I have passed 5 test cases can anyone please help how to optimise code for larger input

    Enter your code here. Read input from STDIN. Print output to STDOUT

    if name=="main": n=int(input()) def squares(value): return sum(int(c)**2 for c in str(value)) a=0 for i in range(1,n+1): if (squares(i)**0.5)==int(squares(i)**0.5): a+=i else: pass print(a)