top of page

Problem 03
This is a C++ solution to Project Euler problem 03 found at: https://projecteuler.net/problem=3
My Algorithm
For this problem, we need to find the largest prime factor of 600851475143. To do this, we can use the fact that every composite number can be written as the product of two other numbers. We start checking at two and continue until the number we are checking squared is not less than the original number. Then, for each factor, if our number can be divided by a factor with a remainder of 0, we divide our number by the factor and update. Once the factor is less than our updated number, we end the program and return the result of 6857 since only a prime number is left.
Full Solution on GitHub
bottom of page