Skip to main content
MedCalc
Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
working

TERMIAL function

Description

Termial function. TERMIAL(n) returns the termial of n, or the nth triangular number $T_n$. For a given non-negative integer n, the termial of n, denoted n?, is defined as the sum of all positive integers up to n: 1+2+3+...+n.

$$\displaystyle \begin{align} T_n &= \sum_{k=1}^n k = 1+2+ \dotsb +n \\ &= \frac{n^2+n \vphantom{(n+1)}}{2} = \frac{n(n+1)}{2} \\ &= {n+1 \choose 2} \end{align} $$

If the argument n is not an integer, it is truncated.

The argument n cannot be negative.

The argument n can be a real number or a matrix. When it is a matrix, the function returns a matrix with the same dimensions and with the TERMIAL function applied to all elements.

The function's name "Termial" was given by Donald Knuth (1997) in analogy with the "Factorial" function.

Example

TERMIAL(5) equals 15 (=1+2+3+4+5)

Calculator

TERMIAL 

Graph

TERMIAL function

References

  • Donald E. Knuth (1997). The Art of Computer Programming: Volume 1: Fundamental Algorithms. 3rd Ed. Addison Wesley Longman, U.S.A. p. 48.

See also

External links