Learn R Programming

onemap (version 0.1-1)

acum: Cumulative sum

Description

Calculates the cumulative sum from 1 to w.

Usage

acum(w)

Arguments

w
a non-negative integer

Value

  • Returns the cumulative sum 1+2+...+w, that is, $$\frac{w \left( w+1 \right)}{2},$$ for $w \geq 0$.

Examples

Run this code
acum(0) # 0

acum(4) # 1+2+3+4

Run the code above in your browser using DataLab