Project Euler: 4 is stated as follows:
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 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
Now I have solved this problem in several ways using programming. One ordinary solution was simply to generate all the products of two 3-digits numbers and pick the largest one. Now this problem can be optimized much further than that, however that is not the point of this question. If one wants to look at a programming solution to this problem, you can find my attempt here.
The first 10 solutions can be found below
1: None x None = None
2: 99 x 91 = 9009
3: 913 x 993 = 906609
4: 9999 x 9901 = 99000099
5: 99979 x 99681 = 9966006699
6: 999999 x 999001 = 999000000999
7: 9997647 x 9998017 = 99956644665999
8: 99999999 x 99990001 = 9999000000009999
9: 999920317 x 999980347 = 999900665566009999
10: 9999999999 x 9999900001 = 99999000000000099999
There is no single digit $a*b$ which can equal a palindrome, since all palindromes are divisible by $11$ and $a,b<10$ since $a$ and $b$ are single digit numbers.
From here a clear pattern emerges. If $n$ is even then the solution is
Solution of the largest palindrome product formed from two even-digit numbers. $$ (\underbrace{9 \ldots 9}_{n \text{ times}}) \times (\underbrace{9 \ldots 9}_{n/2 \text{ times}} \ldots \underbrace{0 \ldots 0}_{n/2 - 1 \text{ times}} \ldots 1) = (\underbrace{9 \ldots 9}_{n/2 \text{ times}} \ldots \underbrace{0 \ldots 0}_{n \text{ times}} \ldots (\underbrace{9 \ldots 9}_{n/2 > \text{ times}}) $$
Which in a pythonic sense can be written as
nine = '9'*(num/2)
num1 = nine + nine
num2 = nine + '0'*(-1 + num/2) + '1'
product = nine + '0'*(num) + nine
return ((int(num1), int(num2)), int(product))
My question is if a similar pattern can be found for the largest palindrome product formed from two odd digit-numbers.
I know a similar question has been asked before. However my question has still not been answered. The previous question was badly formated and contained factual errors. Eg the largest palindromic product formed from two 7-digit numbers is 99956644665999 not 94677111177649.
I'm not sure if trivial solutions for odd n are possible, but they wouldn't be the largest. The trivial solution for even n isn't always the biggest.