Triangular Number

Compute the nth triangular number, equal to the sum of all integers from 1 through n.

Educational purposes only. Not professional advice.

Examples

  • n=3 ⇒ 6
  • n=5 ⇒ 15
  • n=10 ⇒ 55

FAQ

What is a triangular number?

It's the total of the natural numbers from 1 to n.

Can n be zero?

Yes, n=0 gives a triangular number of 0.

Does it handle large n?

Yes, but results grow quickly.

Additional Information

  • Result unit: number