Triangular, pentagonal, and hexagonal | Project Euler | Problem #45
URL to the problem page: https://projecteuler.net/problem=45 Triangle, pentagonal, and hexagonal numbers are generated by the following formulae: Triangle T ₙ =n(n+1)/2 1, 3, 6, 10, 15, ... Pentagonal P ₙ =n(3n−1)/2 1, 5, 12, 22, 35, ... Hexagonal H ₙ =n(2n−1) 1, 6, 15, 28, 45, ... It can be verified that T ₂₈₅ = P ₁₆₅ = H ₁₄₃ = 40755. Find the next triangle number that is also pentagonal and hexagonal. #include <iostream> using namespace std ; int main () { long long i, j, a, result = 0 , triangular, pentagonal, hexagonal; for (i = 286 ; result <= 0 ; i++) { triangular = (i * (i + 1 )) / 2 ; ...