Friday, December 17, 2010

Project Euler - Python - Problem 4

Made some assumptions in this code - dont hate! haha

max, pal = 998001, []
for i in range(max, 100000, -1):
    test = str(i)
    if len(test) == 6:
        if (test[0] == test[-1] and test[1] == test[-2] and test[2] == test[-3]):
            pal.append(i)
print(pal)

for i in pal:
    for x in range(100,999):
        for y in range(100,999):
            if (x*y == i):
                print("%d: %d * %d" % (i, x, y))


No comments: