1 # Adapted from Bill Rubin's code 2 3 def reverse_int(i): 4 r = 0 5 while i != 0: 6 q = i % 10 7 i = i / 10 8 r = r * 10 + q 9 return r 10 11 for n in xrange(1,1000000): 12 if n % 10 == 0: continue 13 r = reverse_int(n) 14 if r == n: continue 15 if n % r != 0: continue 16 print n