Triangular Number Calculator – Find, Check, and Sum T(n)
A triangular number T(n) is the sum of every natural number from 1 to n, and also the number of dots needed to arrange objects in an equilateral triangle: 1, 3, 6, 10, 15, 21, 28, .... The closed-form formula T(n) = n(n+1)/2 lets you compute any term instantly without adding up n numbers one by one. This calculator also solves the reverse problem — given a number, is it triangular, and if so, at which index — plus range sums, sequence generation, and the combinatorial link to Pascal's triangle.
The Formula: T(n) = n(n+1)/2
Every triangular number can be computed directly. For n = 10, T(10) = 10 × 11 / 2 = 55. Because one of n and n+1 is always even, the division by 2 is exact — no fractions ever appear, and this calculator computes the multiplication and division with BigInt so the result stays exact no matter how largen gets.
Gauss's Pairing Trick
The formula has a famous proof attributed to a young Carl Friedrich Gauss. Write the sum 1 + 2 + ... + n forwards, then write it again backwards underneath: n + (n−1) + ... + 1. Adding the two rows column by column, every pair sums to the same value, n + 1, and there are n such pairs. That gives 2 × T(n) = n × (n+1), so T(n) = n(n+1)/2. This calculator's derivation panel walks through the pairing step by step for whichever index you enter.
Checking Whether a Number Is Triangular
To test a number N, solve n(n+1)/2 = N for n using the quadratic formula, which rearranges to n = (−1 + √(1+8N)) / 2. If 1 + 8N is a perfect square and the resulting n is a non-negative whole number, N is triangular. For example, N = 55 gives 1 + 8(55) = 441 = 21², so n = (21 − 1)/2 = 10 — confirming 55 is T(10). The square-root test uses a BigInt-based integer square root, so even enormous numbers are checked exactly rather than with floating-point approximation.
Summing a Range with Tetrahedral Numbers
Adding up a whole range of triangular numbers, like T(5) + T(6) + ... + T(10), doesn't require looping term by term. The running sum of the first n triangular numbers is itself a closed-form value called a tetrahedral number: n(n+1)(n+2)/6. A range sum from n₁ to n₂ is then just the difference of two tetrahedral numbers, computed in constant time regardless of how wide the range is.
The Handshake Problem and C(n+1, 2)
Triangular numbers show up constantly in combinatorics. If n+1 people are in a room and each shakes hands with every other person exactly once, the total number of handshakes is C(n+1, 2) = T(n). This is the same identity that places triangular numbers along the third diagonal of Pascal's triangle. Every result in this calculator is shown alongside its C(n+1, 2) restatement as an alternate way to reach the same answer.
Square Triangular Numbers and Other Special Cases
A handful of triangular numbers are also perfect squares — these are called square triangular numbers, and they get rarer very quickly: 1, 36, 1225, 41616, .... For instance T(8) = 36 = 6². The calculator automatically checks every result against this property, along with the much rarer case of a triangular number coinciding with a perfect number such as 6 or 28.