# A special number

Here is a nice puzzle from my friend.

Can you find a number that is a product of two consecutive primes and when multiplied by its own reversal produces a palindrome? The answer may surprise you. No computers please.

I didn't use programming but used a calculator. I think the answer is

11021 = 103 × 107, where 11021 × 12011 = 132373231 is a palindrome.

First I observed that

if the resulting palindrome has an even number of digits, it must be a multiple of 11, so the only candidates were 7 × 11 and 11 × 13, neither of which worked.

Note that n is a multiple of 11 if and only if its reverse is a multiple of 11, which can be seen from the divisibility rule by 11: n is a multiple of 11 iff its alternating sum of digits is. E.g. 10417 is a multiple of 11 because 1 - 0 + 4 - 1 + 7 = 11, and so is 71401 because 7 - 1 + 4 - 0 + 1 = 11.

Therefore

the palindrome (n times mirror of n) must have an odd number of digits, which can happen only if both the first and last digits of n are low.

So I started searching for

the possible values of n, where the primes are a power of 10 plus a small number. I jumped right away to 101 × 103, then tried 103 × 107, which worked.

After finding this answer, I decided to check if there are other possible answers (of course using a program).

Turns out there are two more:

13 × 17 = 221, 221 × 122 = 26962
43 × 47 = 2021, 2021 × 1202 = 2429242
Other than the three already mentioned, there are no solutions until 1,000,000th prime. Note that all digits are 2 or lower in all the solutions.

The program used:

Factor, which has enough built-ins for the job:

1000000 nprimes [ * ] 2clump-map
[ dup 10 >base reverse dec> * 10 >base dup reverse = ] filter .

Try it online!

I still like my original answer the most, because

it can be nicely divided into chunks of digits:

132 = 11 × 12
373 = 121 + 252 = 11 × 11 + 12 × 21
231 = 21 × 11
→ 132,373,231 = 11,021 × 12,011

• This is correct! Well done. For me the second smallest answer was a surprise. Jan 7 at 5:09
• @DmitryKamenetsky Yeah, that was a small surprise to me too, because it was out of the range I was searching in (primes slightly larger than powers of 10). That said, it might have been feasible to find all three by hand if I noticed earlier that (3,7) is the only last-digit combination that produces 1 as the last digit. (There are (1,1) and (9,9) too, but they don't appear up to 120). Jan 7 at 5:16
• "it must be a multiple of 11, so the only candidates were 7 × 11 and 11 × 13" Why?
– tsh
Jan 7 at 7:19
• @tsh Because a number is a multiple of 11 iff its reverse is a multiple of 11. Jan 7 at 9:48