Triangular Numbers Calculator
Enter a position n to find the corresponding triangular number, or switch to reverse mode and enter a known triangular number to recover its position. The calculator also generates a sequence of up to 20 consecutive triangular numbers starting from your n, shows a bar chart of the growth, and walks through the arithmetic step by step.
Formula
Worked example
For n = 7: T(7) = 7 x 8 / 2 = 56 / 2 = 28. Verification: T(6) = 21, and 21 + 7 = 28. Square relation: T(7) + T(6) = 28 + 21 = 49 = 7^2.
What is a triangular number?
A triangular number is the count of dots that can be arranged in an equilateral triangle. The first triangular number is 1 (a single dot), the second is 3 (a triangle with 2 dots on each side), the third is 6, and so on. Each new triangular number is formed by adding the next counting number to the previous one: T(1)=1, T(2)=1+2=3, T(3)=1+2+3=6, T(4)=1+2+3+4=10. The concept appears in ancient Greek mathematics and shows up in combinatorics, algebra, and even physics.
The triangular number formula
Instead of adding up all the integers by hand, you can use the closed-form expression T(n) = n x (n+1) / 2. This is also written as the binomial coefficient "n+1 choose 2". A famous proof attributed to Gauss doubles the triangle to form a rectangle of width n and height (n+1), giving n(n+1) dots total, then halves that to get T(n). The formula works for any non-negative integer n, and T(0) = 0 by convention.
Reverse lookup: is a number triangular?
To check whether a given number T is triangular, compute 8T + 1 and test whether the result is a perfect square. If sqrt(8T + 1) is an integer, then T is triangular and its position is n = (sqrt(8T + 1) - 1) / 2. For example, T = 28: 8 x 28 + 1 = 225, sqrt(225) = 15, n = (15 - 1) / 2 = 7, confirming T(7) = 28. If 8T + 1 is not a perfect square, T is not a triangular number.
Properties and real-world uses
Every triangular number is half of a rectangular number (n times n+1). Two consecutive triangular numbers always add up to a perfect square: T(n) + T(n-1) = n^2. Triangular numbers count the number of handshakes in a fully connected group: in a room of n people, each pair shakes hands once, giving T(n-1) handshakes. They also count the number of objects stacked in a triangular pile (like bowling pins, stacked cannonballs in 2D, or fruit at a market stall). In combinatorics, T(n) equals the number of ways to choose 2 items from n+1 without repetition.
First 20 triangular numbers
| n | T(n) | Sum (1+2+...+n) | Square: T(n)+T(n-1) |
|---|---|---|---|
| 1 | 1 | 1 | 1 (= 1^2) |
| 2 | 3 | 1+2 | 4 (= 2^2) |
| 3 | 6 | 1+2+3 | 9 (= 3^2) |
| 4 | 10 | 1+...+4 | 16 (= 4^2) |
| 5 | 15 | 1+...+5 | 25 (= 5^2) |
| 6 | 21 | 1+...+6 | 36 (= 6^2) |
| 7 | 28 | 1+...+7 | 49 (= 7^2) |
| 8 | 36 | 1+...+8 | 64 (= 8^2) |
| 9 | 45 | 1+...+9 | 81 (= 9^2) |
| 10 | 55 | 1+...+10 | 100 (= 10^2) |
| 11 | 66 | 1+...+11 | 121 (= 11^2) |
| 12 | 78 | 1+...+12 | 144 (= 12^2) |
| 13 | 91 | 1+...+13 | 169 (= 13^2) |
| 14 | 105 | 1+...+14 | 196 (= 14^2) |
| 15 | 120 | 1+...+15 | 225 (= 15^2) |
| 16 | 136 | 1+...+16 | 256 (= 16^2) |
| 17 | 153 | 1+...+17 | 289 (= 17^2) |
| 18 | 171 | 1+...+18 | 324 (= 18^2) |
| 19 | 190 | 1+...+19 | 361 (= 19^2) |
| 20 | 210 | 1+...+20 | 400 (= 20^2) |
T(n) = n x (n+1) / 2. These are the most commonly encountered values.
Frequently asked questions
What is the formula for the nth triangular number?
T(n) = n x (n + 1) / 2. For example, the 10th triangular number is 10 x 11 / 2 = 55. You can also think of it as the sum of all whole numbers from 1 to n.
How do I check if a number is triangular?
Compute 8T + 1 and check whether it is a perfect square. If sqrt(8T + 1) is a whole number, then T is triangular and its position is n = (sqrt(8T + 1) - 1) / 2. For instance, 36: 8 x 36 + 1 = 289, sqrt(289) = 17, n = (17 - 1) / 2 = 8, so T(8) = 36.
Why do two consecutive triangular numbers add up to a perfect square?
T(n) + T(n-1) = n(n+1)/2 + (n-1)n/2 = n[(n+1) + (n-1)] / 2 = n x 2n / 2 = n^2. So T(7) + T(6) = 28 + 21 = 49 = 7^2. This identity means you can tile a square grid of side n with one triangular arrangement pointing up and one pointing down.
What are triangular numbers used for in real life?
Triangular numbers count handshakes (n people - T(n-1) pairs), bowling pin arrangements (T(4) = 10 pins), snooker ball racks (T(5) = 15 balls), and stacked log piles. In networking, a fully connected graph of n nodes has T(n-1) edges. They also appear in Pascal's triangle: the third diagonal is 1, 3, 6, 10, 15, which are exactly the triangular numbers.
Is every triangular number also a hexagonal number?
Every hexagonal number is triangular, but not every triangular number is hexagonal. The hexagonal numbers (1, 6, 15, 28, 45, ...) form a subset: H(n) = n(2n-1) = T(2n-1). So the odd-indexed triangular numbers (T(1), T(3), T(5), ...) are exactly the hexagonal numbers.
What is the largest commonly used triangular number?
There is no theoretical upper limit: T(n) grows roughly as n^2 / 2, so large n gives very large triangular numbers quickly. T(100) = 5050, T(1000) = 500500, T(10000) = 50005000. This calculator handles positions up to 10,000.