You are viewing a single comment's thread. Return to all comments →
100 points. Python 3
non_lychrel={} n=int(input().strip()) for i in range(10,n): j=0 t=i while j<60 and str(t)!=str(t)[::-1]: t=t+int(str(t)[::-1]) j+=1 if str(t)==str(t)[::-1]: non_lychrel[t]=non_lychrel[t]+1 if t in non_lychrel else 1 m=max(non_lychrel,key=non_lychrel.get) print(m,non_lychrel[m])
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #55: Lychrel numbers
You are viewing a single comment's thread. Return to all comments →
100 points. Python 3