in reply to Re^2: Largest palindrome number for a 3 digit product of 2 numbers
in thread Largest palindrome number for a 3 digit product of 2 numbers

Yes. If the square of the greater operand is smaller than the highest palindrome found, further rundown of either factor can be stopped. There is no higher number to be found.

My algorithm differs from salvas solution, which probes the highest factors for a valid product, while mine runs down one factor to its lowest value. For some amount of digits it turns out to be faster than salva's, for others it is much, much slower (e.g. 9 digits).

update: Another approach would be:

I guess that for a large amount of digits this might be the fastest way.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
  • Comment on Re^3: Largest palindrome number for a 3 digit product of 2 numbers