Finding the n-th term and sum of an arithmetic series