Multiplying two large primes is easy. The result is a huge non-prime number. Factoring this number however, is non-trivial. This is the basis behind a lot of Cryptographic algorithms.
999415083136585001 is a product of two primes. These two primes are palindromes. Find the sum of these two palindromes.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
I used Fermat's Factorization,here N = 999415083136585001. N = a 2 − b 2 and so the two primes are a + b and a − b .
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
Almost immediately,the output.i.e: 1 9 9 9 4 1 4 9 9 8
There are only 5 9 5 3 palindromic primes less than 1 0 9 (having a file listing the primes less than 1 0 9 after solving one of Thaddeus' previous problems was useful!). Checking the two of these which multiplied together to get the right answer was elementary: 9 9 9 6 8 6 9 9 9 × 9 9 9 7 2 7 9 9 9 = 9 9 9 4 1 5 0 8 3 1 3 6 5 8 5 0 0 1 .
I think optimal prime testing algorithms such as the Sieve of Eratosthenes would be appropriate for this problem. Since the number is a product of two palindromic prime numbers, it would be efficient to start from 9 9 9 4 1 5 0 8 3 1 3 6 5 8 5 0 0 1 and try incrementing and decrementing from there.
Problem Loading...
Note Loading...
Set Loading...
The fact that the number starts with 9 9 9 . . . and ends with . . . 0 0 1 suggests that the both factors are of the form 9 9 9 x y x 9 9 9 . Following this hunch, we can expand
9 9 9 4 1 5 0 8 3 1 3 6 5 8 5 0 0 1 − ( 9 9 9 0 0 0 9 9 9 + 1 0 1 0 0 0 a 1 + 1 0 0 0 0 a 2 ) ( 9 9 9 0 0 0 9 9 9 + 1 0 1 0 0 0 b 1 + 1 0 0 0 0 b 2 ) ) =
1 4 1 2 0 8 7 1 3 3 5 8 7 0 0 0 − 1 0 0 8 9 9 1 0 0 8 9 9 0 0 0 a 1 − 9 9 9 0 0 0 9 9 9 0 0 0 0 a 2 − 1 0 0 8 9 9 1 0 0 8 9 9 0 0 0 b 1 − 1 0 2 0 1 0 0 0 0 0 0 a 1 b 1 − 1 0 1 0 0 0 0 0 0 0 a 2 b 1 − 9 9 9 0 0 0 9 9 9 0 0 0 0 b 2 − 1 0 1 0 0 0 0 0 0 0 a 1 b 2 − 1 0 0 0 0 0 0 0 0 a 2 b 2
From this we can deduce that b 1 = 1 3 − a 1 and then b 2 = 1 0 − a 2 , and then from those we end up with solving for a 1 :
1 0 c + 2 − 3 a 1 + a 1 2 = 0
where c is an integer. From this, we find that a 1 = 6 , a 2 = 8 , b 1 = 7 , b 2 = 2 , and the numbers are
( 9 9 9 6 8 6 9 9 9 ) ( 9 9 9 7 2 7 9 9 9 ) = 9 9 9 4 1 5 0 8 3 1 3 6 5 8 5 0 0 1