Triangle, Pentagonal and Hexagonal numbers are generated by the following formulae:
Triangle Tn=n(n+1)/2 generates the numbers 1, 3, 6, 10, 15,...
Pentagonal Pn=n(3n-1)/2 generates the numbers 1, 5, 12, 22, 35,..
Hexagonal Hn=n(2n-1) generates the numbers 1, 6, 15, 28, 45,...
It can be verified that T285 = P165 = H143 = 40755
Find the next triangle number that is also pentagonal and hexagonal.
Information at Project Euler 045
Getting Started
Click on the Show Solution to show the solution. Click on the Hide Solution to hide the solution.
User Stories
As a user, I can get the solution to be shown or hidden.
As a user, I expect the function triPentaHexa(40756)
to return a number.
As a user, I expect the function triPentaHexa(40756)
to return 1533776805.
User Stories on function triPentaHexa(n)
taken from FreeCodeCamp - Coding Interview Prep - Project Euler 045
Information Architecture
The function triPentaHexa(n)
returns a number, where n is a number.
Allows the user to show or hide the solution to the problem as described in Project Euler 045.
Uses HTML5, CSS3, JavaScript, Bootstrap 5.2.2 and Google Fonts.
Ensure all user stories have been met.
Deployed on GitHub Pages at the main branch.
Written by me.