Let a be the first term in the sequence. If r is the ratio between consecutive terms, then the second term is ar, the third term is ar ^2, the fourth is ar ^3, and so on, up to the n-th term ar ^(n - 1).
So the third, fourth, and fifth terms are such that
ar ^2 = 18
ar ^3 = 27
ar ^4 = 81/2
Solve for a and r :
(ar ^3) / (ar ^2) = 27/18 => r = 3/2
ar ^2 = a (3/2)^2 = 9/4 a = 18 => a = 8
Then the n-th term in the sequence is
ar ^(n - 1) = 9 (3/2)^(n - 1)
You can rewrite this by first rewriting 9 = 3^2, then
9 (3/2)^(n - 1) = 3^2 * 3^(n - 1) / 2^(n - 1) = 3^(n + 1)/2^(n - 1)