A challenge from the Mensa Puzzle Calendar

Konrad Koller koko9991 at compuserve.de
Mon Oct 7 05:31:58 EDT 2002


On 4 Oct 2002 10:15:17 -0700, chris.myers at prov.ingenta.com (Chris
Myers) wrote:

>So, my generalized sol'n of Raymond's answer is:
>for a in range(1000):
>    for b in range(100):
>        digits = list('%.3d%.2d%.5d' % (a, b, a*b))
>        digits.sort()
>        if digits == list('0123456789'):
>            print '\n%5.3d\n%5.2d\n-----\n%5.5d' % (a, b, a*b)
>
Another small changes in Raymond's excellent program:

import string; alldigits=list(string.digits)
for a in range(12,988):
    for b in range(1,99):
        digits = list('%.3d%.2d%.5d' % (a, b, a*b))
        digits.sort()
        if digits == alldigits: print '%3u*%2u=%5.5u' % (a, b, a*b)



More information about the Python-list mailing list