Largest Palindrome Product

A palindromic number reads the same both ways. The largest palindrome made from the product of two $2$-digit numbers is $9009 = 91 \times 99$.
Find the largest palindrome made from the product of two $3$-digit numbers.

To find the largest palindrome made from the product of two 3-digit numbers, we need to try different 3-digit numbers and verify whether they form a palindrome.

One way to do this is by trying different products systematically, such as starting from the largest possible product of two 3-digit numbers (999 * 999 = 998001), and going downwards until we find a palindrome.

But when searching for the palindrome, keep in mind that palindromes are usually divisible by 11. Therefore, at least one factor needs to be divisible by 11. This helps in decreasing the search space.

The Python code for finding the largest palindrome is provided below:

“`
max_palindrome = 0

for i in range(999, 100, -1):

# since palindromes are usually divisible by 11
# it is sufficient to start the second loop at either i or the next lowest multiple of 11
if i % 11 == 0:
jstart = i
jstep = 1
else:
jstart = i – (i % 11)
jstep = 11

for j in range(jstart, 100, -jstep):

# stopping the loop early if we have already found a larger palindrome
if (i * j <= max_palindrome): break # create a string s from integer i*j s = str(i * j) # check if s is a palindrome and if the palindrome is larger than our current max_palindrome if s == s[::-1] and i * j > max_palindrome:
max_palindrome = i * j

print(max_palindrome)
“`

When you run this Python script, you will get the answer: the largest palindrome made from the product of two 3-digit numbers is 906609=913×993.

More Answers:
Multiples of $3$ or $5$
Even Fibonacci Numbers
Largest Prime Factor

Error 403 The request cannot be completed because you have exceeded your quota. : quotaExceeded

Share:

Recent Posts