adding a method to calculate the sum of an arithmetic series.