1, 3, 6, 10, 15, 21… The triangular numbers count the dots in a triangle built row by row. This triangular numbers calculator takes a position n to give the n-th triangular number and the tetrahedral number, and takes any number to test to show its position in the sequence, whether it is triangular and the neighbors on each side.
How the calculation works
- Triangular number Tₙ = n × (n + 1) ÷ 2, the sum of the whole numbers from 1 to n.
- Tetrahedral number = n × (n + 1) × (n + 2) ÷ 6, the sum of the first n triangular numbers.
- Position of a number N in the sequence = (√(8N + 1) − 1) ÷ 2. If this is a whole number, N is triangular.
- Neighbors = the triangular numbers at the whole positions just below and above that position.
Example
The 100th triangular number is 100 × 101 ÷ 2 = 5,050, the answer to the famous schoolboy sum of 1 + 2 + … + 100. The sum of the first 100 triangular numbers is 171,700. To test 55, the position is (√441 − 1) ÷ 2 = 10, a whole number, so 55 is the 10th triangular number.
Why it matters
Triangular numbers are the formula behind the sum of the first n whole numbers, which comes up in programming loops, handshake and round-robin tournament counts, stacking oranges or cans and many number puzzles. The closed formula replaces a long sum by one multiplication, and the test shows how to recognize them.
Good to know
The formula n(n + 1) ÷ 2 is exact for whole numbers n, and results grow quickly: for n beyond about 10 million the numbers pass 10¹⁴, where decimal precision can fail. The test for a triangular number uses a square root, so for very large values rounding can give a wrong answer in the last digits. The position of a non-triangular number is shown with decimals, and the nearest triangular numbers on each side are given. The number 1 is the first triangular number, and some authors also count 0.
Related tools
The arithmetic-geometric series calculator handles other sums, the sequence calculator covers arithmetic and geometric progressions and the combinations calculator counts pairs, which gives triangular numbers.