Project Euler – Problem 4

From the Project Euler

Problem 4:
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 * 99.
Find the largest palindrome made from the product of two 3-digit numbers


Because of 999 * 999 = 998001, the wanted palindrome is equal or less than 997799.
I created a class Palindrome with a method that returns the lower palindrome.
Using the code for the problem 3 I found all prime factors of each palindrome.
I created an object List<List<Long>> that contains all the factors of each palindrome (it would have been sufficient List<List<Integer>>)
I created an object Set<Product> that contains all the pairs of numbers multiplied together give the palindrome.



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.