def lucky(num):
b = 0
for i in range(10):
if num // (10**i) == 0:
x = i
break
if num == 1:
print(True)
elif num < 10:
print(False)
else:
c = num
for j in range(x-1):
b = b + (c%10)**2
c = c//10
b = b + c**2
num = b
return lucky(num)
happy = eval(input())
lucky(happy)
结果是: