The GP is: 4, 3*4, 3^2*4, 3^3*4, ... so a=4 and r=3.
S=4(1+3+3^2+3^3+...)=4(3^n-1)/(3-1)=2(3^n-1). When 2(3^n-1)>30000, 3^n-1>15000.
nlog3>log15001, n>log15001/log3, n>8.75, so n>8 (integer), the sum of more than 8 terms.
S9=2(3^9-1)=39364. So 9 is the smallest number of terms.