From 1161f9a034de06a63538e3a9a0b7717098c744d9 Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Fri, 7 Apr 2023 08:13:49 -0500 Subject: Initial Commit --- Problem38.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Problem38.py (limited to 'Problem38.py') 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 -- cgit v1.2.3