Compute the nth triangular number (Tn = n·(n+1)/2), test any integer for the triangular property, and see the beautiful dot triangle pattern.
| n | Tn | n | Tn |
|---|
A triangular number counts the number of dots that can form an equilateral triangle. The nth triangular number Tn is the sum of the first n natural numbers: Tn = 1 + 2 + 3 + ... + n = n(n+1)/2. This sequence (1, 3, 6, 10, 15, 21, 28, ...) appears in numerous mathematical and real‑world contexts, from combinatorics to computer science.
Legendary anecdote: Carl Friedrich Gauss, at age 8, solved 1+2+...+100 instantly by pairing numbers: 101 × 50 = 5050 → T100 = 5050.
The formula Tn = n(n+1)/2 can be proven by induction or by geometric rearrangement: a triangle of dots complemented by an identical inverted triangle forms an n × (n+1) rectangle. Triangular numbers are binomial coefficients: Tn = C(n+1, 2). Moreover, every perfect square is the sum of two consecutive triangular numbers: n² = Tn-1 + Tn. Additional fascinating properties: Tn + Tn-1 = n²; the sum of the first n triangular numbers gives the nth tetrahedral number; and all even perfect numbers are triangular (Euclid–Euler theorem).
The digital root of triangular numbers cycles (1,3,6,1,6,3,1,9,9) and Tn modulo 9 reveals interesting patterns. Triangular numbers also play a role in the Riemann zeta function and appear in the solution to the handshake problem: in a room with n people, the number of handshakes is Tn-1.
Algorithmic note for triangular testing: Given an integer \(x\), the equation \(n(n+1)/2 = x\) rearranges to \(n^2 + n - 2x = 0\). The positive root is \(n = \frac{\sqrt{8x+1} - 1}{2}\). \(x\) is triangular iff \(8x+1\) is a perfect square and \(\sqrt{8x+1}\) is odd. Our implementation uses double-precision floating-point with an epsilon tolerance of \(10^{-10}\), correctly handling all integers up to \(10^{15}\) without overflow in JavaScript’s safe integer range.
Given a positive integer x, we solve n(n+1)/2 = x → n² + n - 2x = 0. The positive root is n = (√(8x + 1) - 1)/2. x is triangular iff √(8x+1) is an odd integer. Our tester instantly applies this discriminant method with high precision.
| Integer | Triangular? | n (if yes) | Property context |
|---|---|---|---|
| 1 | Yes | 1 | Trivial triangle |
| 6 | Yes | 3 | Classic example |
| 55 | Yes | 10 | T10 = 55 |
| 91 | Yes | 13 | Polygonal connection |
| 120 | Yes | 15 | Also hexagonal |
At a networking gathering with 20 attendees, if every person shakes hands with each other exactly once, the total number of handshakes equals T19 = 190. Event planners use triangular numbers to estimate seating arrangements and icebreaker pairing. Our calculator instantly validates such counts: try n = 20 → T20 = 210, which would be handshakes for 21 participants. This combinatorial insight originated from early graph theory and remains a staple in discrete mathematics education.
Nicomachus of Gerasa (c. 60–120 AD) observed that the sum of the first n cubes equals the square of the nth triangular number: (1³+2³+...+n³) = (Tn)². For instance, 1³+2³+3³ = 36 = 6² and T3 = 6. This elegant identity links triangular numbers with cubic sums, used in number theory proofs and recreational mathematics.