You are viewing a single comment's thread. Return to all comments →
n = int(input()) sum = 0 for i in range(2, n+1): for j in range(1, 9+1): for k in range(1, 9+1): temp = (j*(10**(i-1) - k))%(10*k - 1) if temp == 0: ans = f"{int((j*(10**(i-1) - k))/(10*k - 1))}"+ f"{j}" if len(ans) > 5: sum += int(ans[-5:len(ans)+1]) print(ans) else: sum += int(ans) print(ans)
Please tell me what I am doing wrong, this code is only passing 2 test cases.
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #168: Number Rotations
You are viewing a single comment's thread. Return to all comments →