L
The recurrence is therefore
L0 = 1 ;
Ln = Ln−1 + n , for n > 0.
The known values of L1 , L2 , and L3 check perfectly here, so we'll buy this. Now we need a closed-form solution. We could play the guessing game again, but 1 , 2 , 4 , 7 , 11 , 16 , . . . doesn't look familiar; so let's try another tack. We can often understand a recurrence by "unfolding" or "unwinding" it all the way to the end, as follows:
Ln = Ln-1 + n
= Ln−2 + (n − 1) + n
= Ln−3 + (n − 2) + (n − 1) + n
.
.
= L0 + 1 + 2 + · · · + (n − 2) + (n − 1) + n
= 1 + Sn , where S n = 1 + 2 + 3 + · · · + (n − 1) + n.
In other words, L n is one more than the sum S n of the first n positive integers.
I didn't understand how
= L0 + 1 + 2 + · · · + (n − 2) + (n − 1) + n is derived from previous step