top of page

Problem 04

This is a C++ solution to Project Euler problem 04 found at: https://projecteuler.net/problem=4

My Algorithm

For this problem, we need to find the largest palindrome that can be formed by the product of two 3-digit numbers. Essentially, our upper product bound is 999 x 999 = 998001. To do this, we can make a function that takes in a 3-digit number and returns a 6-digit number. With this, we can loop through all 3-digit numbers starting at the upper bound and search for a 3-digit divisor. If this is found, then we have found the largest palindrome formed by the product of two 3-digit numbers.

Full Solution on GitHub

© 2023 by Matthew Woodring

    bottom of page