Finding the nth term of a geometric sequence