Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

Triangular Numbers Calculator






What is a Triangular Number?

A triangular number is the count of dots needed to form an equilateral triangle of side length nn. Starting with one dot at the top and adding one more dot to each successive row:

T1=1,T2=3,T3=6,T4=10,T5=15,T_1 = 1, \quad T_2 = 3, \quad T_3 = 6, \quad T_4 = 10, \quad T_5 = 15, \quad \ldots


The nn-th triangular number TnT_n equals the sum of the first nn positive integers:

Tn=1+2+3++n=k=1nkT_n = 1 + 2 + 3 + \cdots + n = \sum_{k=1}^{n} k


This sum has a famous closed form, sometimes called the Gauss formula:

Tn=n(n+1)2T_n = \frac{n(n+1)}{2}


The pairing trick that produces the formula: write the sum forward and backward, add term by term to get nn pairs of n+1n + 1, divide by 2. Carl Friedrich Gauss is said to have rediscovered this at age 9. For deeper coverage see triangular number, arithmetic series, and Gauss summation.

The Closed Form and Why It Works

Two distinct proofs of Tn=n(n+1)/2T_n = n(n+1)/2 — both worth knowing.

Algebraic (Gauss pairing). Write the sum and its reverse:

S=1+2+3++nS=n+(n1)+(n2)++1\begin{aligned} S &= 1 + 2 + 3 + \cdots + n \\ S &= n + (n-1) + (n-2) + \cdots + 1 \end{aligned}


Adding column by column gives nn pairs each summing to n+1n + 1:

2S=n(n+1)    S=n(n+1)22S = n(n+1) \implies S = \frac{n(n+1)}{2}


Geometric (rectangle). Two copies of a triangular dot pattern can be rotated and fitted together into an nn by n+1n + 1 rectangle. The rectangle has n(n+1)n(n+1) dots; one triangle has half:

Tn=n(n+1)2T_n = \frac{n(n+1)}{2}


Why the formula is always an integer. Of nn and n+1n + 1, one is even, so the product is divisible by 2. The formula produces an integer for every positive integer nn.

The Membership Test

Given a positive integer mm, deciding whether it is triangular reduces to a perfect-square check.

The test. mm is triangular if and only if 8m+18m + 1 is a perfect square. When it is, the index is

n=8m+112n = \frac{\sqrt{8m + 1} - 1}{2}


Why it works. From Tn=n(n+1)/2=mT_n = n(n+1)/2 = m, multiply by 8 and add 1:

4n2+4n+1=8m+1    (2n+1)2=8m+14n^2 + 4n + 1 = 8m + 1 \implies (2n+1)^2 = 8m + 1


So 8m+18m + 1 is a perfect square exactly when mm is triangular, and the square root recovers nn.

Example. Is 120 triangular? Compute 8120+1=9618 \cdot 120 + 1 = 961. Then 961=31\sqrt{961} = 31, an integer. So n=(311)/2=15n = (31 - 1)/2 = 15, meaning 120=T15120 = T_{15}. Indeed 1516/2=12015 \cdot 16 / 2 = 120.

Non-example. Is 100 triangular? Compute 8100+1=8018 \cdot 100 + 1 = 801. Then 80128.30\sqrt{801} \approx 28.30, not an integer. So 100 is not triangular. The nearest triangular numbers are T13=91T_{13} = 91 and T14=105T_{14} = 105.

Properties and Identities

Triangular numbers satisfy many identities that connect them to other figurate numbers and counting problems.

Recurrence: Tn=Tn1+nT_n = T_{n-1} + n with T1=1T_1 = 1. Each triangular number adds one more row to the triangle.
Binomial coefficient: Tn=(n+12)T_n = \binom{n+1}{2}. The nn-th triangular number counts unordered pairs from n+1n + 1 objects.
Sum of consecutive triangulars: Tn+Tn1=n2T_n + T_{n-1} = n^2. Two consecutive triangular numbers add to a perfect square.
Sum of first $n$ triangulars: T1+T2++Tn=n(n+1)(n+2)6=TenT_1 + T_2 + \cdots + T_n = \frac{n(n+1)(n+2)}{6} = \mathrm{Te}_n, the nn-th tetrahedral number.
Sum of first $n$ cubes: 13+23++n3=Tn21^3 + 2^3 + \cdots + n^3 = T_n^2. The sum of the first nn cubes equals the square of the nn-th triangular number.
Hexagonal connection: every hexagonal number is also triangular: Hn=T2n1H_n = T_{2n-1}.
Square triangulars: a triangular number that is also a perfect square satisfies a Pell equation; examples are 1, 36, 1225, 41616, infinitely many but sparse.

Common Applications

Triangular numbers appear naturally in counting problems where every pair, edge, or comparison is counted once.

Handshakes. In a room of n+1n + 1 people who all shake hands once, the total number of handshakes is TnT_n.
Pairs from a set. The number of unordered pairs from n+1n + 1 items is (n+12)=Tn\binom{n+1}{2} = T_n.
Round-robin tournaments. A tournament where each of n+1n + 1 players plays every other once has TnT_n matches.
Edges in a complete graph. The complete graph on n+1n + 1 vertices, Kn+1K_{n+1}, has TnT_n edges.
Diagonals plus sides. An (n+1)(n + 1)-gon has TnT_n total segments (diagonals plus sides) connecting its vertices.
Stacked objects. Bowling pins, billiard balls, and any triangularly-stacked array of nn rows contain TnT_n objects.
Lazy caterer. The maximum number of pieces from nn straight cuts of a pizza is Tn+1T_n + 1 — the cake number minus a constant.

Triangular Numbers and Pascal's Triangle

Triangular numbers form a diagonal of Pascal's triangle. The third diagonal (counting from 0) reads 1, 3, 6, 10, 15, 21, exactly the triangular numbers.

The identity Tn=(n+12)T_n = \binom{n+1}{2} says: the nn-th triangular number equals the number of ways to choose 2 items from n+1n + 1. The connection between binomial coefficients and figurate numbers generalizes: the kk-th diagonal of Pascal's triangle gives the kk-dimensional figurate numbers.

Diagonal 0: all 1's — the trivial sequence.
Diagonal 1: 1, 2, 3, 4, the natural numbers (1-dimensional simplex counts).
Diagonal 2: 1, 3, 6, 10, the triangular numbers (2D triangle counts).
Diagonal 3: 1, 4, 10, 20, the tetrahedral numbers (3D triangle pyramid counts).
Diagonal 4: 1, 5, 15, 35, the pentatope numbers (4D simplex counts).

This nesting is captured by the hockey-stick identity: summing any diagonal up to a point gives the next diagonal's entry. The sum of the first nn triangular numbers being Ten\mathrm{Te}_n is one instance.

Common Mistakes

Off-by-one in the index. T1=1T_1 = 1, not T0=1T_0 = 1. The convention starts at n=1n = 1. Some sources start at n=0n = 0 with T0=0T_0 = 0; the explorer here uses T1=1T_1 = 1.

Confusing triangular with square or other figurate numbers. A triangular number counts dots in a triangle; a square number counts dots in a square; a pentagonal number counts dots in a pentagon. The closed forms differ: Tn=n(n+1)/2T_n = n(n+1)/2, Sn=n2S_n = n^2, Pn=n(3n1)/2P_n = n(3n-1)/2. Numbers can be both (e.g., 1 and 36 are both triangular and square).

Misapplying the membership test. The test is 8m+18m + 1 a perfect square, not m+1m + 1 or 4m+14m + 1. The factor 8 comes from completing the square in n2+n=2mn^2 + n = 2m.

Negative or fractional indexes. The closed form n(n+1)/2n(n+1)/2 technically extends to all real nn, but only positive integers are triangular numbers in the standard sense. T1.5T_{1.5} has no combinatorial meaning.

Confusing the sum with the count. TnT_n is the sum of the first nn integers, not the count. The count is nn itself.

Related Sequences and Concepts

Square NumbersSn=n2S_n = n^2. Dots arranged in a square. Tn+Tn1=n2T_n + T_{n-1} = n^2 connects triangular and square numbers.

Pentagonal NumbersPn=n(3n1)/2P_n = n(3n-1)/2. The next figurate family. Membership test uses 24m+124m + 1.

Hexagonal NumbersHn=n(2n1)H_n = n(2n-1). Every hexagonal number is triangular: Hn=T2n1H_n = T_{2n-1}.

Tetrahedral NumbersTen=n(n+1)(n+2)/6\mathrm{Te}_n = n(n+1)(n+2)/6. The sum of the first nn triangular numbers; the 3D analog.

Square Triangular Numbers — numbers that are both triangular and square: 1, 36, 1225, 41616, ... They satisfy a Pell equation and grow exponentially.

Arithmetic SeriesTnT_n is the sum of the first nn terms of the arithmetic series with a1=1a_1 = 1, d=1d = 1. The general formula Sn=n(a1+an)/2S_n = n(a_1 + a_n)/2 specializes to TnT_n.

Gauss Sum — the classical formula for 1+2++n1 + 2 + \cdots + n, equal to TnT_n. The cornerstone of summation techniques.

Pascal's Triangle — row positions (n+12)=Tn\binom{n+1}{2} = T_n. Triangular numbers form the third diagonal.

Binomial CoefficientTn=(n+12)T_n = \binom{n+1}{2}. The number of unordered pairs from n+1n + 1 objects.

Combinatorics — the discipline. Triangular numbers solve canonical counting problems: pairs, handshakes, edges in complete graphs.

Figurate Numbers — the general family of polygonal and polyhedral counts. Triangular numbers are the 2D, 3-sided case.

Polygonal Numbers — the umbrella term for triangular, square, pentagonal, hexagonal, heptagonal, octagonal, and so on. The rr-gonal number formula is Pn(r)=n[(r2)n(r4)]2P_n^{(r)} = \frac{n[(r-2)n - (r-4)]}{2}.