Skip to content

Commit

Permalink
Add solution 004
Browse files Browse the repository at this point in the history
  • Loading branch information
eberjoe committed Jan 6, 2019
1 parent 551e48b commit 2704633
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions problem004.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Largest palindromic product with factors of 'n' digits

n = 3
floor = 10**(n-1)
ceiling = 10**n
bigpal = 0

for i in range(floor, ceiling):
for j in range(i, ceiling):
product = i*j
if str(product) == str(product)[::-1] and product > bigpal:
bigpal = product
f1 = i
f2 = j
print(f1, "x", f2, "=", bigpal)

0 comments on commit 2704633

Please sign in to comment.