fork download
  1. def flip(n): return int(''.join(reversed(str(n))))
  2.  
  3. def isLychrel(n):
  4. for i in xrange(50):
  5. n1 = n + flip(n)
  6. if n1 == flip(n1): return False
  7. n = n1
  8. return True
  9.  
  10. print len([n for n in xrange(10000) if isLychrel(n)])
Success #stdin #stdout 0.1s 23352KB
stdin
Standard input is empty
stdout
249