During my exam period I have been solving some problems over at Project Euler as a little relaxation between work sessions. I came across a problem that concerned triangle, pentagonal and hexagonal numbers that triggered my interest. The task was specifically finding a number that is a triangle, pentagonal and hexagonal number, and my programming solution to the problem can be found at GitHub.
What triggered my interest was that looking at the first few numbers from each sequence it seemed like all the hexagonal number were included in the triangle numbers, and in fact they are. The proof is as follows.
The numbers are generated by the following formulae:
| Triangle | ![]() |
1, 3, 6, 10, 15,… |
| Hexagonal | ![]() |
1, 6, 15, 28, 45,… |
We test the triangle number with index t, and the hexagonal number with index h.

We then solve the quadratic equation for t.

Which gives the following two solutions:

Because we only look at positive integers for our formula, we can throw away the second solution, and we are left with an equation that states a relationship between the hexagonal and triangle number. This proves that for all positive integers, the hexagonal numbers are in the triangle numbers.