Finding the nth term of an A.P