1 ================================================================== 2 # Reverse Divisible Numbers 3 4 for n in range(1,1000000): 5 if n%10==0: continue # Get rid of numbers ending in zero 6 7 # Compute digits and reverse digits: 8 reverse = [] 9 reverse.append(n%10) 10 quotient = n/10 11 while quotient!=0: 12 reverse.append(quotient%10) 13 quotient = quotient/10 14 15 from copy import deepcopy # Tried moving this up out of the loop 16 digits = deepcopy(reverse) 17 digits.reverse() 18 19 if reverse==digits: continue # Get rid of palindromes 20 21 # Compute reverse number in fixed point: 22 r = digits.pop() 23 while len(digits)!=0: 24 r = 10*r + digits.pop() 25 26 if n%r!=0: continue # Get rid of number if not evenly divisible 27 print n