Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

Triangular Numbers Calculator

How to use Triangular Numbers Calculator
  1. Pick a mode with the four tabs across the top of the card: List first N, List a – b, Test a number or Lookup by index; the ? beside each tab describes it. Learn more about the modes
  2. In List first N, type how many terms to show in Show first and click Update; the cards give the count, the largest term and the sum, and the tiles list every term. Learn more about listing terms
  3. In List a – b, type the From index and the To index and click List range; a red box explains a bad range. Learn more about ranges
  4. In Test a number, type a positive integer in Test number and click Check; a green box names the index, a red box says it is not triangular. Learn more about the test
  5. In Lookup by index, type the position in Index n and click Get term. Learn more about lookups
  6. The panel on the right explains the current mode and walks through the arithmetic with your own numbers; it changes with every tab and click. Learn more about the panel





Listing the First N Terms

DemoTen terms, thirty terms, the cap, one term
Step 0 of 4
The explorer opens on the List first N tab, one of four tabs across the top of the card; the small ? beside each tab shows what the mode does. Type how many terms you want in the Show first box and click Update or press Enter. Three cards answer at once: Showing gives the count, Largest the last term with its index, and Sum the total of the listed terms, which for triangular numbers is the tetrahedral number N(N+1)(N+2)/6N(N+1)(N+2)/6. Under the cards every term is laid out as a tile with its index above its value, so T1=1T_1 = 1 to TNT_N can be read in order.

The box accepts 11 to 200200: 1010 gives T10=55T_{10} = 55 with the sum 220220, 3030 gives T30=465T_{30} = 465 with the sum 4,9604{,}960, and 300300 is capped at 200200 terms, ending at T200=20,100T_{200} = 20{,}100 with the sum 1,353,4001{,}353{,}400; a single term gives T1=1T_1 = 1. Large values are printed with thousands separators. A count of 0, a decimal or an empty box is refused with "Enter a positive integer." There is no Reset button: type a new count and click Update again. The panel on the right, List first N, states the closed form the tiles come from, and its walkthrough repeats the last term and the sum with your own NN. Why the terms are the sums 1+2+⋯+n1 + 2 + \cdots + n is explained in what is a triangular number.

Listing a Range of Indexes

DemoThe range tab, 10 to 20, two bad ranges
Step 0 of 4
Click the List a – b tab to list the terms between two positions instead of starting from 11. Type the From index and the To index and click List range or press Enter. The cards give the Count b−a+1b - a + 1, the Smallest term TaT_a and the Largest term TbT_b, and the tiles below list every term in between with its index. The tab opens with 55 to 1515, eleven terms from T5=15T_5 = 15 to T15=120T_{15} = 120; indexes 1010 to 2020 give eleven terms from 5555 to 210210.

Both boxes must hold positive integers, the first no larger than the second, and the range may hold at most 200200 terms; otherwise a red box explains: "Enter two positive integer indexes", "From-index must be less than or equal to to-index", or "Range too wide — cap is 200 terms". The panel on the right, List a – b, explains the mode, and its walkthrough names the smallest and largest term of your range. The formula each tile uses is proved in the closed form and why it works.

Testing a Number

DemoThe test tab, 100, 5050, 0
Step 0 of 4
Click the Test a number tab to ask whether a given positive integer is triangular. Type it in the Test number box and click Check or press Enter. A green box with a tick answers yes and names the index, as for the opening value 120120, which is T15T_{15}; a red box with a cross answers no, as for 100100, and the walkthrough on the right then shows the two nearest triangular numbers, T13=91T_{13} = 91 and T14=105T_{14} = 105. A large value is handled the same way: 5,0505{,}050 is T100T_{100}.

The box takes positive integers only; 00, a negative number or a decimal is refused with "Enter a positive integer". The test behind the answer is exact: the explorer checks whether 8m+18m + 1 is a perfect square and, when it is, reads the index off its square root, so no list has to be searched. The panel on the right, Test a number, states this rule, and its walkthrough carries out the arithmetic for your number. The rule itself is derived in the membership test.

Looking Up a Term by Index

DemoThe lookup tab, n = 100, n = 1000, n = 0
Step 0 of 4
Click the Lookup by index tab to compute one term directly. Type the position in the Index n box and click Get term or press Enter. Two cards answer: Index repeats nn and Value gives TnT_n with its index as a subscript. The tab opens with n=42n = 42, which gives T42=903T_{42} = 903; n=100n = 100 gives 5,0505{,}050 and n=1,000n = 1{,}000 gives 500,500500{,}500. The box takes positive integers only; 00 is refused with "Enter a positive integer index".

The panel on the right has two parts in every mode. How it works names the rule the mode uses, here the closed form Tn=n(n+1)/2T_n = n(n+1)/2, and links to the section of this page that explains it; Walkthrough applies the rule to the numbers you typed, so for the lookup it shows n(n+1)/2n(n+1)/2 with your nn filled in and the product worked out. Both change as soon as you switch tabs or click a button. The closed form and its two proofs are in the closed form and why it works.

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 definition is given in definition and the sequence is placed among the others in triangular numbers.

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+(n−1)+(n−2)+⋯+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 same derivation is written out in derivation of the closed form.

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+1−12n = \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 8⋅120+1=9618 \cdot 120 + 1 = 961. Then 961=31\sqrt{961} = 31, an integer. So n=(31−1)/2=15n = (31 - 1)/2 = 15, meaning 120=T15120 = T_{15}. Indeed 15⋅16/2=12015 \cdot 16 / 2 = 120.

Non-example. Is 100 triangular? Compute 8⋅100+1=8018 \cdot 100 + 1 = 801. Then 801≈28.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.

The identities the test rests on are collected in properties.

Properties and Identities

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

• Recurrence: Tn=Tn−1+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+Tn−1=n2T_n + T_{n-1} = n^2. Two consecutive triangular numbers add to a perfect square.
• Sum of first nn 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 nn 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=T2n−1H_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.

The recurrence is the subject of recursive form and the other identities of properties.

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.

The counting identity behind these uses is in properties; the sequence's place among the classic ones is triangular numbers.

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.

The binomial form of TnT_n is listed in properties; the neighbouring diagonal of squares is square numbers.

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(3n−1)/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.

Index conventions and the two ways of defining a sequence are explained in definition and notation and explicit and recursive definitions.