DEV Community


Discussion on: Project Euler #4 - Largest Palindrome Product

maxart2501 profile image
Massimo Artizzu

The problem here is that the products you're getting aren't ordered. Which means that if you get a palindrome, you cannot be sure it's the largest.

In fact, I run your code and I got 999 * 91 = 90909, which is not correct. Even if you limit your range to 999 to 100 (we're looking for 3-digit factors after all), you'd get 995 * 583 = 580085. But the largest palindrome is 993 * 913 = 906609, which comes after the others.