Given,
$(1+a x)^{n}=1+6 x+\frac{27}{2} x^{2}+\ldots+a^{n} x^{n} \,\,\,\,\,\dots(i)$
The expansion of $(1+a x)^{n}$ is,
$(1+a x)^{n}=1+n a x+\frac{n(n-1)}{2 !}(a x)^{2}+\ldots (ii)$
On comparing the coefficient of like powers of $x$ in Eqs. (i) and (ii),
$na=6\,\,\,\,\, \dots(iii)$
$\frac{27}{2}=\frac{n(n-1)}{2} \cdot a^{2}$
$ \Rightarrow \, 27 =(n-1)(n a) \cdot a $
$ 27 -(n-1) a 6 $ [from E (iii)]
$(n-1) a=\frac{9}{2}\,\,\,\,\,\,\dots(iv)$
From Eqs. (iii) and (iv),
$\frac{(n-1) 6}{n}=\frac{9}{2}$
$\Rightarrow\,\frac{n-1}{n}=\frac{3}{4}$
$\Rightarrow \, 4 n-4=3 n$
$\Rightarrow \, n=4$
From E (iii), $a=\frac{6}{4}$
$\Rightarrow \, a=3 / 2$