Finding terms in an arithmetic sequence