summaryrefslogtreecommitdiff
path: root/Problem38.py
blob: fdcfeb5188845f692a448a43b4dbb805a878ee83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#Completed 9/13/2021 13:48
import math
def isPandigital(n):
    n = str(n)
    for x in range(0,len(n)):
        if n.count(n[x]) > 1 or n.count("0") != 0:
            return False
        else: continue
    return True
def multiply(n):
    m= str(n)
    y = 0
    if len(m) == 2: y = 5
    elif len(m) == 3: y = 4
    elif len(m) == 4: y = 3
    for x in range(2, y):
        m+= str(n*x)
    return int(m)
max = 0
for x in range(1,10000):
    if isPandigital(multiply(x)) == True and multiply(x) > max: max = multiply(x)
print("Answer is:", max)