All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Largest palindrome (Posted on 2015-04-27)
The largest palindrome expressable as a product of two 2-digit numbers is 9009 = 91 × 99.

What is the largest palindrome that is a product of two 3-digit numbers?

Source: Project Euler.

 No Solution Yet Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 re: program solution | Comment 3 of 4 |
(In reply to program solution by Charlie)

Running Time.

Since this was a Euler project:

7*11*13 = 1001, so though 1001*999=999999, the first number is too big.
6*11*13 = 858, and without too much effort, 888888 (=924*962) can be seen to be a qualifying palindrome.
Let's assume then that both the three-digit numbers a and b exceed 900.
Then: (900+a)*(900+b)=900009+1100*c+10010*d
(a+900) (b+900) = 11(100c+910d+81819), and 11 divides a or b, say a. So a must be {902,913,924,...990}
If a is even, a*b is even; if a ends in 5, a*b ends in 0 or 5. So a is {913,957,979}, only 3 choices. a*b ends in 9.
So:
a=913: b ends in 3.
a=957: b ends in 7
a=979: b ends in 9.

leaving only 30 combinations to check.

 Posted by broll on 2015-04-27 22:07:32

 Search: Search body:
Forums (0)