DEV Community

Discussion on: Improve Your Algorithms with this Simple Equation

Collapse
 
ri5hirajp profile image
Rishiraj Purohit • Edited

How about sum of any arithmetic series ?
varsitytutors.com/hotmath/hotmath_...

To find the sum of the first n terms of an arithmetic sequence use the formula,
Sn=n(a1+a2)/2 ,where n is the number of terms, a1 is the first term and an is the last term.


Find the sum of the first 40 terms of the arithmetic sequence : 2,5,8,11,14,⋯
First find the 40 th term: a40=a1+(n−1)d =2+39(3)=119
Then find the sum . 40(2+119) / 2 = 2420