Skip to content
Snippets Groups Projects
Commit b5d097ae authored by Taddeüs Kroes's avatar Taddeüs Kroes
Browse files

Solve 55

parent 9c71c621
No related branches found
No related tags found
No related merge requests found
55.py 0 → 100755
#!/usr/bin/env python
def rev(n):
r = 0
base = 1
while n > 0:
div, rem = divmod(n, 10)
r = r * 10 + rem
base *= 10
n = div
return r
def is_lychrel(n):
niter = 0
while niter < 50:
n += rev(n)
if rev(n) == n:
return False
niter += 1
return True
print sum(int(is_lychrel(n)) for n in xrange(1, 10000))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment