summaryrefslogtreecommitdiff
path: root/Problem38.py
diff options
context:
space:
mode:
authorJoshua Drake <joshua.drake@ditchwitch.com>2023-04-07 08:13:49 -0500
committerJoshua Drake <joshua.drake@ditchwitch.com>2023-04-07 08:13:49 -0500
commit1161f9a034de06a63538e3a9a0b7717098c744d9 (patch)
tree55bb842b2daa4f096eb7916a8d3630426fc1c376 /Problem38.py
Initial CommitHEADmaster
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