g=lambda n:abs(n-int(str(n)[::-1]))def r(n): t=g(n);h=g(t) while t-h:h=g(g(h));t=g(t) return h print(r(5067))print(r(1584))
Standard input is empty
0 6534
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!