#B3650. Summation of Series
Summation of Series
Summation of Series
Given an integer ( n ) (with (1 \le n \le 10^7)), your task is to compute the cumulative sum of numbers from 1 to ( i ) for each ( i ) from 1 to ( n ).
In other words, for each ( i ) from 1 to ( n ), output the sum:
[
S_i = \frac{i(i+1)}{2}
]
For example, when ( n = 5 ):
- Line 1 outputs: 1
- Line 2 outputs: 3 (because (1+2=3))
- Line 3 outputs: 6 (because (1+2+3=6))
- Line 4 outputs: 10 (because (1+2+3+4=10))
- Line 5 outputs: 15 (because (1+2+3+4+5=15))
inputFormat
The input consists of a single integer ( n ) which satisfies (1 \le n \le 10^7).
outputFormat
Output ( n ) lines. The ( i^{th} ) line should contain the sum of integers from 1 to ( i ), i.e., (S_i = 1+2+\cdots+i).
sample
1
1