Imagine a triangle of numbers which follows this pattern:

 * Starting with the number "1", "1" is positioned at the top of the triangle. As this is the 1st row, it can only support a single number.
 * The 2nd row can support the next 2 numbers: "2" and "3"
 * Likewise, the 3rd row, can only support the next 3 numbers: "4", "5", "6"
 * And so on; this pattern continues.

```
    1
   2 3
  4 5 6
 7 8 9 10
...
```

Given N, return the sum of all numbers on the Nth Row:

1 <= N <= 10,000

Difficulty: introductory

Starter code:

def cumulative_triangle(n):
	

Solutions:
def cumulative_triangle(n):
    return n*(n*n+1)/2

def cumulative_triangle(n):
    return (n**3+n)/2

def cumulative_triangle(n):
    return n*(n*n+1)//2

cumulative_triangle=lambda n:(n**3+n)/2

def cumulative_triangle(n):
    start = sum(range(n)) + 1
    return sum(range(start, start + n))

def cumulative_triangle(n):
    f = lambda x: 0.5 * x * (x - 1) + 1
    s = f(n)
    r = []
    while len(r) < n:
        r.append(s)
        s += 1
    return sum(r)

cumulative_triangle=lambda n:n*(n*n+1)/2

def cumulative_triangle(n):
    # find last number (x) of nth row
    x = sum(range(n+1))
    # add all numbers from (x-n, x)
    return sum(range(x-n+1,x+1))

def cumulative_triangle(n):
    # sum of elements of the n-th row
    return (n**2 + 1) * n // 2

def cumulative_triangle(n):
    N = n * (n+1) // 2
    prev = n * (n-1) // 2
    return N * (N+1) // 2 - prev * (prev+1) // 2