Pentagonal numbers are generated by the formula, Pn = n(3n-1)/2. The first ten pentagonal numbers are:
1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ...
It can be seen that P4 + P7 = 22 + 70 = 92 = P8. However, their difference is not pentagonal.
Find the pair of pentagonal numbers, Pj and Pk, for which their sum and difference are pentagonal and D = |Pk - Pj| is minimised, what is the value of D.
Information at Project Euler 044
Getting Started
Click on the Show Solution button to show the solution. Click on the Hide Solution button 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 pentagonNumbers()
to return a number.
As a user, I expect the function pentagonNumbers()
to return 5482660.
User Stories on function pentagonNumbers()
is taken from FreeCodeCamp - Coding Interview Prep - Project Euler 044
Information Architecture
The function pentagonNumbers()
returns a number.
Allows the user to show or hide the solution to the problem as described in Project Euler 044.
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.