# Multiplies of 3 and 5

First read the problem description.

The sum of an arithmetic progression is \(S_n=\frac{n*(a_1+a_n)}{2}\). In our case \(a_n = a_1 * n\) so we have \(S_n=\frac{a_1*n*(n+1)}{2}\). We use the above formula to calculate the sum of the multiplies of 3 and 5 minus the sum of the multiplies of 15 (since \(3 * 5 = 15\), multiplies of 15 are counted two times).

Source code of the solution(s):