Finding the terms in an A.P.