top of page

Problem 12

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

My Algorithm

For this problem, we are asked to find the first triangle number to have over five hundred divisors. A triangle number is formed by adding the natural numbers together. To complete this problem, we can create a function that calculates the number of divisors as we have in previous problems. Then, we can simply loop through all numbers and keep track of the current triangle number. Once a number with over five hundred divisors is found, the loop breaks and returns the current triangle number. This results in a final answer of 76576500.

Full Solution on GitHub

© 2023 by Matthew Woodring

    bottom of page