The sequences, and the differences that define them.
The sequence and its differences
The differences are what define the family.
triangular number 10, from n(n + 1)/2
55
The first ten are 1, 3, 6, 10, 15, 21, … and the differences between them are 2, 3, 4, 5, 6, … — which is what defines the family.
Value
55
the 10th triangular number
Formula
n(n + 1)/2
in terms of n
First differences
2, 3, 4, 5, 6
what generates the sequence
Is 28 triangular?
yes, the 7th
8 × 28 + 1 = 225, which is 15² — a perfect square
The first ten triangular numbers, with the gap to the next one beneath each.
n
Value
Difference to next
1
1
2
2
3
3
3
6
4
4
10
5
5
15
6
6
21
7
7
28
8
8
36
9
9
45
10
10
55
—
Triangular numbers are the running totals of 1, 2, 3, … — which is why the differences between consecutive ones are just the counting numbers.
A number N is triangular exactly when 8N + 1 is a perfect square, which is a quick test that needs no searching.
Every even perfect number is triangular. 6, 28, 496 and 8128 are all in this sequence, which is not a coincidence — it follows from their form 2^(p−1)(2^p − 1).
The formula is n(n + 1)/2, and the differences between consecutive terms are shown above — a figurate sequence is defined by that difference pattern rather than by the picture.
Computed on arbitrary-precision integers, so the 100,000th tetrahedral number is exact rather than rounded.
What this tool shows
A figurate family is defined by its differences, not by its picture. Triangular numbers have the counting numbers as differences; squares have the odd numbers — which is why 1 + 3 + 5 + … + (2n − 1) = n².
Triangular, square and pentagonal numbers
Hexagonal, tetrahedral and cubic numbers
The difference pattern of each family
A closed test for triangularity
Why every hexagonal number is triangular
The connection to perfect numbers
Six families Difference patterns A closed test Exact at any size
Six families, with a triangularity test alongside.
Updated 7 September 2026 · Works in any browser, no installation
The differences are what define the family. Triangular numbers go 1, 3, 6, 10, 15 with differences 2, 3, 4, 5 — the counting numbers. Squares go 1, 4, 9, 16 with differences 3, 5, 7 — the odd numbers, which is exactly why the odd numbers sum to a square.
At a glance
Formula shown
Triangular n(n + 1)/2, square n², pentagonal n(3n − 1)/2, hexagonal n(2n − 1), tetrahedral n(n + 1)(n + 2)/6, cubic n³. A number N is triangular exactly when 8N + 1 is a perfect square.
Scenario support
Recognising a sequence in a puzzle; counting objects arranged in a triangle or a stack; a number theory exercise.
Educational estimate
Planning support from the values you enter — not professional advice.
Differences define the family
Every figurate sequence is a running total of something, and that something is its difference pattern.
Triangular numbers are the running totals of 1, 2, 3, 4, … so their differences are the counting numbers. The nth is n(n + 1)/2, which Gauss famously worked out as a schoolchild by pairing the ends.
Square numbers have the odd numbers as differences: 1, 4, 9, 16 differ by 3, 5, 7. So 1 + 3 + 5 + … + (2n − 1) = n², which the Greeks proved by drawing L-shaped borders around a square — each border is the next odd number.
Tetrahedral numbers are running totals of the triangular numbers: a stack of triangular layers, which is how cannonballs and oranges are piled.
Seeing the differences is more useful than seeing the picture, because the differences generalise and the picture does not — there is no drawing for a four-dimensional figurate number, and the difference rule works anyway.
Is a number triangular?
There is a closed test, and it needs no searching: N is triangular exactly when 8N + 1 is a perfect square.
It comes straight from the formula. N = n(n+1)/2 rearranges to n² + n − 2N = 0, and the quadratic formula gives n = (−1 + √(8N + 1))/2. That is a whole number exactly when the square root is.
So 28 is triangular because 8×28 + 1 = 225 = 15², and the index is (15 − 1)/2 = 7. 30 is not, because 241 is not a square.
This page uses an integer square root on arbitrary-precision integers, so the test is exact for numbers far beyond what a double could hold — and the test suite checks it against a direct search over every value to 2,000, because a closed test that disagreed with a search would be worse than no test at all.
How the families overlap
The families are not disjoint, and the overlaps are more interesting than the definitions.
Every hexagonal number is triangular. The nth hexagonal number is the (2n − 1)th triangular one, so the hexagonals are exactly the odd-indexed triangulars. The reverse is not true.
Numbers that are both triangular and square are rare: 1, 36, 1225, 41616. They come from a Pell equation, and there are infinitely many, each roughly 34 times the last.
Both tetrahedral and square is rarer still: only 1, 4 and 19600. Proving there are no others took until 1878.
Every even perfect number is triangular. 6, 28, 496 and 8128 are all in the sequence, and it is not a coincidence — it follows from their form 2^(p−1)(2^p − 1), which is the triangular number of index 2^p − 1.
Where they turn up
Triangular numbers appear far more often than their definition suggests.
Handshakes. The number of pairs among n people is the (n−1)th triangular number. So is the number of edges in a complete graph, and the number of comparisons a naive duplicate check makes.
Pool balls and bowling pins. 15 and 10 are triangular, which is why those arrangements are neat.
Pascal’s triangle. The third diagonal is the triangular numbers and the fourth is the tetrahedral ones — they are binomial coefficients wearing a different name.
Pentagonal numbers appear in Euler’s pentagonal number theorem, which gives a startlingly efficient recurrence for counting partitions. Nobody would guess that from the geometry.
Where it gets used
Recognising a sequence. Given 1, 3, 6, 10, the difference pattern identifies the family immediately, which is the first step in most sequence puzzles.
Counting arrangements. Objects stacked in triangles or pyramids, and pairwise counts in combinatorics.
Algorithm analysis. A nested loop where the inner one shortens each time runs a triangular number of iterations, which is where the n²/2 in a bubble sort comes from.
Number theory. As a route into Pell equations, partitions and perfect numbers, all of which connect back to these sequences.
Sources and methodology
Figurate numbers are classical; these are the references.
Method. Values are computed on arbitrary-precision integers, so the hundred-thousandth tetrahedral number is exact rather than rounded through a double. The triangularity test uses the closed 8N + 1 condition with an integer square root rather than searching, and the suite checks it against a direct search over every value to 2,000 — a closed test that disagreed with the search would be worse than no test. That engine is verified on every change against 99 hand-written assertions, including that the 8N + 1 test agrees with a direct search to 2,000, that triangular and tetrahedral values match running sums, and that every hexagonal number is triangular. The count and the per-case breakdown are published on the formula verification page.
Related calculators
Where this goes next:
Arithmetic SequenceNth term and sum with both formulas substituted, carried as exact fractions — a step of 0.1 gives exactly 4 at term 40 rather than 3.9999999999999996.
Prime NumberWhether a number is prime, with a divisor named when it is not and the size of the search stated when it is. Deterministic, not probabilistic.
Consecutive IntegersThe run that sums to your target, or the reason there is not one — plus every run a number admits, and why the powers of two admit none.
Golden Ratioφ, the golden rectangle and the Fibonacci ratios converging on it — with an honest account of where φ genuinely appears and where the folklore does not hold up.
Digital RootEvery round of digit addition shown, with the mod-9 shortcut alongside — and a casting-out-nines checker that will show you a wrong sum passing.
FibonacciEvery digit of F(n), not a rounded double — a JavaScript number stops being exact at F(79), and F(80) is where most web calculators quietly go wrong.
Published the figurate numbers page leading with the difference pattern rather than the pictures, since that is what defines each family — and it generalises where a drawing does not.
Includes the closed test for triangularity: N is triangular exactly when 8N + 1 is a perfect square, computed with an integer square root on arbitrary-precision integers and checked against a direct search over every value to 2,000.
Notes the overlaps that make the topic interesting — every hexagonal number is triangular, every even perfect number is triangular, and only 1, 4 and 19600 are both tetrahedral and square.
Add this calculator to your site
Responsive embed — and private: nothing your visitors type leaves their browser.