Finding the number of terms in an Arithmetic Progression