How the Triangular Numbers Calculator Works
A triangular number counts the dots that form an equilateral triangle: 1 dot, then a row of 2 beneath it, then a row of 3, and so on. The nth triangular number, written Tn, is the sum of every whole number from 1 to n: 1 + 2 + 3 + ... + n. Gauss's classic trick — pairing the first and last terms — gives the closed-form formula Tn = n(n + 1) / 2, so you never have to add the terms one at a time.
Formula and derivation
Write the sum forwards and backwards, then add the two rows together: (1+2+...+n) + (n+...+2+1) forms n pairs, each summing to (n+1), for a total of n(n+1). Dividing by 2 (because you added the sum to itself) gives Tn = n(n+1)/2. This calculator also finds the tetrahedral number — the sum of the first n triangular numbers — using the related closed form n(n+1)(n+2)/6, and tests whether an arbitrary value is a triangular number by checking whether 8x+1 is a perfect square, derived by solving n² + n − 2x = 0 with the quadratic formula.
Reading the sequence and the triangularity test
Enter n to get Tn directly, along with a preview of the sequence T₁, T₂, T₃, ... up to the length you choose. To check whether some other number is triangular, enter it in the third field: the calculator solves n = (√(8x+1) − 1) / 2 and reports the matching index only when that value works out to a non-negative whole number.
Common mistakes
- Starting the sequence at the wrong term: by convention T₀ = 0 and T₁ = 1 — the first "row" already contains a single dot.
- Confusing triangular numbers with square numbers: Tn grows roughly like n²/2, not n² — for example, T₅ = 15, not 25.
- Assuming every number is triangular: most integers are not; only values where 8x+1 is a perfect square qualify (1, 3, 6, 10, 15, 21, 28, ...).
Real-world applications
- Counting handshakes or round-robin matchups among n people or teams: the number of unique pairings equals Tn-1, the same as the combination C(n, 2).
- Stacking problems, such as cannonball piles, bowling pins (T₄ = 10), or a rack of pool balls (T₅ = 15) arranged in a triangle.
- Combinatorics: Tn equals the binomial coefficient C(n+1, 2), the number of ways to choose 2 items from n+1.
- Computer science: triangular numbers describe the comparison count in simple nested loops and the edge count of a complete graph.