Let the first $6$ terms of the G.P. be $a,ar,ar^2,ar^3,ar^4,ar^5$

It is given that sum of first 3 terms= 16 and

sum of next three terms =128

$i.e.,a+ar+ar^2=16\:\;and\:\:ar^3+ar^4+ar^5=128$

$\Rightarrow\:a(1+r+r^2)=16$...(i) and $ar^3(1+r+r^2)=128$...(ii)

$\Rightarrow\:1+r+r^2=\large\frac{16}{a}$

Step 2

Substituting the value of $1+r+r^2$ in (ii) we get

$\Rightarrow\:ar^3\times \large\frac{16}{a}$$=128$

$\Rightarrow\:r^3=\large\frac{128}{16}$$=8$

$\Rightarrow\:r=2$

Step 3

Substituting the value of $r$ in (i) we get

$1+2+2^2=\large\frac{16}{a}$

$\Rightarrow\:a=\large\frac{16}{7}$

Step 4

Substituting the value of $a$ and $r$ in $S_n$ we get

Sum of $n$ terms of the G.P.$ =S_n=a.\large\frac{r^n-1}{r-1}$

$=\large\frac{16}{7}.\frac{2^n-1}{2-1}=\large\frac{16}{7}$$.(2^n-1)$