summaryrefslogtreecommitdiff
path: root/Problem55.py
blob: 2ce11cb8fed654aefee7802af271b17392b71be1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
def isPalindrome(n):
    if n == int(str(n)[::-1]): return True
    return False
def isLychrel(n):
    revn = int(str(n)[::-1])
    n += revn
    count = 0
    while isPalindrome(n) == False:
        if count >= 50: return True
        revn = int(str(n)[::-1])
        n += revn
        count+=1
    return False

count = 0
for x in range(1,10000):
    if isLychrel(x): count+=1
print(count)