R. Alan Monroe wrote:
> I wrote a lame, but working script to solve this in a few minutes. A
> fun puzzle.

FWIW here is my fastest solution:

from itertools import chain
def compute():
     str_=str; int_=int; slice_=slice(None, None, -1)
     for x in chain(xrange(1, 1000001, 10), xrange(2, 1000001, 10), 
xrange(3, 1000001, 10), xrange(4, 1000001, 10), xrange(5, 1000001, 10), 
xrange(6, 1000001, 10), xrange(7, 1000001, 10), xrange(8, 1000001, 10), 
xrange(9, 1000001, 10)):
         rev = int_(str_(x)[slice_])
         if rev>=x: continue
         if not x % rev:
              print x,
compute()

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to