If I had only seen the one liner at Slick or Slack (a pretty slick place) before writing this monstrosity:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | pal = 0 i = 999 while i > 0: j = 999 while j > 0: ftemp = str(i * j) rtemp = "" for letter in ftemp: rtemp = letter + rtemp if ftemp == rtemp: if pal < i*j: pal = i*j break j = j - 1 i = i - 1 print pal |
Yes I did skip #3 since I have yet to figure out how to factor huge numbers without it taking some huge distributed computing system due to my inefficient code.