Find the biggest possible palindrome of 2 numbers with n digits

Consider the following: p is a palindrome and the product of 2 integers.

Then: $$ p = l*h = (10^n-x)*(10^n-y) = 10^n*(10^n-(x+y))+xy $$

Let left be $$10^n-(x+y)$$ and right be $$xy$$

Looking at the $$ l*h$$ and $$ (10^n-x)*(10^n-y) $$ shows: $$x=(10^n-l)$$

We can get left from right, by mirroring it. That means, we only need to find right or left. (Excercise to the reader).

Now, we set $$z=x+y$$ then: $$ right = xy = x((x-x)+y)= x*(z-x) $$

We can form this as an quadratic equation now: $$ -x^2 +zx + right = 0 $$

We just need to find an integer solution for x now, to find a palindrome. To make the palindrome as big as possible, we need z as small as possible

Solution:

X:

Y: