Triangular Number Calculator
Find the nth triangular number, the next one, and digit count fast.
What it does
Triangular numbers count dots that form a triangle. One row has 1 dot, next adds 2, then 3, and so on. The total after n rows is the nth triangular number, written T(n). Bowling pins, pool racks, and handshake counts all follow this pattern.
The tool above returns T(n), the next triangular number T(n+1), and the digit count of T(n). The default n = 100 matches the worked example, so the page opens showing 5,050. Type a new n to update all three results.
The closed form n(n+1)/2 replaces long addition. Summing 1 to 100 by hand takes many steps and invites error. The formula needs one multiplication, one addition, and one halving. It also explains why T(n) grows near n squared over 2.
These numbers link to combinations: T(n) equals C(n+1, 2), the ways to pick 2 from n+1. That is why handshake problems use the same math. In a room with n+1 people, each pair shaking once gives T(n) handshakes.
This page shows the formula, a full hand checked example at n = 100, a short table of early values, and practice checks that run through the tool.
How to use
- Pick the position n you need, for example 100 for the sum 1 to 100.
- Type n as a whole number. Fractions trigger an error.
- Keep n between 1 and 1000000 to stay in exact integer range.
- Read T(n) as the main result.
- Read T(n+1) to see the next triangle, useful for spotting growth.
- Use digit count to plan storage or display width for large T(n).
Formula
- n
- Position in the sequence, a whole number.
- T(n)
- Sum 1 + 2 + ... + n.
- T(n+1)
- Next triangular number after T(n).
The product n(n+1) is always even, so division by 2 stays whole. For n = 1, T = 1. Values above n = 1000000 are blocked to keep integer math exact and fast.
Worked example
Example: n = 100
Find the sum 1 + 2 + ... + 100 with the triangular formula.
- Write n = 100.
- Add one: n + 1 = 101.
- Multiply: 100 x 101 = 10,100.
- Halve: 10,100 / 2 = 5,050.
- Read T(100) = 5,050 with 4 digits.
- Next: T(101) = 101 x 102 / 2 = 10,302 / 2 = 5,151.
Reference table
| n | T(n) | Sum it replaces |
|---|---|---|
| 1 | 1 | 1 |
| 2 | 3 | 1 + 2 |
| 3 | 6 | 1 + 2 + 3 |
| 4 | 10 | 1 + 2 + 3 + 4 |
| 10 | 55 | 1 to 10 |
| 100 | 5,050 | 1 to 100 |
Limits
- Whole n only. Fractions and negatives have no triangular meaning here.
- Capped at n = 1000000 to keep results exact in browser math.
- Counts dots and pairs, not areas. Do not mix with square numbers.
- Large T(n) needs commas and width. Check digit count before printing.
Common mistakes
- Using n squared over 2 and dropping the +1, so T(100) becomes 5000 instead of 5050.
- Adding 1 after halving instead of before multiplying.
- Entering n = 0 and expecting a triangle. This tool starts at n = 1.
- Confusing T(n) with n factorial, which grows far faster.
- Reading T(n+1) as T(n) plus n + 2. It is T(n) plus n + 1.
Try it yourself
Quick checks. Answers sit tucked under each question.
T(10)?
10 x 11 / 2 = 55. Next is 66 with 2 digits.
T(1000)?
1000 x 1001 / 2 = 500,500. Next is 501,501 with 6 digits.
Questions
What is a triangular number?
n(n+1)/2. It equals 1 + 2 + ... + n.
Why is T(100) 5050?
100 x 101 / 2 = 5050. Pairing 1+100, 2+99, and so on gives fifty pairs of 101.
Are triangular numbers the same as handshake numbers?
Yes. Handshakes among n+1 people equal T(n).
What is the next triangular after T(n)?
T(n+1) = (n+1)(n+2)/2. The gap is n+1.
Can n be a fraction?
Not in this tool. n must be a whole number from 1 to 1000000.
How fast does T(n) grow?
Near n squared over 2. Doubling n roughly quadruples T(n).