summaryrefslogtreecommitdiff
path: root/Problem38.py
diff options
context:
space:
mode:
Diffstat (limited to 'Problem38.py')
-rw-r--r--Problem38.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/Problem38.py b/Problem38.py
new file mode 100644
index 0000000..fdcfeb5
--- /dev/null
+++ b/Problem38.py
@@ -0,0 +1,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) \ No newline at end of file