Let the three consecutive terms be $$(r-1)th, rth , (r+1)th $$ terms.
That is, $$T_{r-1}, T_{r}. T_{r+1}$$.
We know that general term of expansion $$(a+b)^{n}$$ is
$$T_{r+1}={n_{C}}_{r}a^{n-r}b^{r}$$
For $$(1+x)^{n}$$,
Putting $$a=1, b=x$$,
$$T_{r+1}={n_{C}}_{r}1^{n-r}x^r$$
$$T_{r+1}={n_{C}}_{r}x^r$$
Therefore, coefficient of $$(r+1)th$$ term = $${n_{C}}_{r}$$
For $$rth$$ term of $$(1+x)^{n}$$
Replacing r with r-1, we get,
$$T_{r}={n_{C}}_{r-1}x^{r-1}$$
Therefore, coefficient of $$rth$$ term = $${n_{C}}_{r-1}$$
For $$(r-1)th$$ term of $$(1+x)^{n}$$
Replacing r with r-2. we get,
$$T_{r-1}={n_{C}}_{r-2}x^{r-2}$$
Therefore, coefficient of $$(r-1)th$$ term = $${n_{C}}_{r-2}$$
Since the coefficient of (r-1)th, rth and (r+1)th terms are in the ratio 1 : 7 : 42,
$$\dfrac{{n_{C}}_{r-2}}{{n_{C}}_{r-1}}=\dfrac{1}{7}$$
$$\dfrac{\dfrac{n!}{(r-2)![n-(r-2)]!}}{\dfrac{n!}{(r-1)![n-(r-1)]!}}=\dfrac{1}{7}$$
$$\dfrac{(r-1)[n-(r-1)]!}{[n-(r-2)]!}=\dfrac{1}{7}$$
$$\dfrac{(r-1)(n-r+1)!}{(n-r+2)!}=\dfrac{1}{7}$$
$$\dfrac{(r-1)(n-r+1)!}{(n-r+2)(n-r+1)!}=\dfrac{1}{7}$$
$$\dfrac{(r-1)}{(n-r+2)}=\dfrac{1}{7}$$
$$n-8r+9=0$$ ......(1)
Also,
$$\dfrac{\dfrac{n!}{(r-1)![n-(r-1)]!}}{\dfrac{n!}{r!(n-r)!}}=\dfrac{7}{42}$$
$$\dfrac{n!}{(r-1)!(n-r+1)!} \times \dfrac{r!(n-r)!}{n!}=\dfrac{1}{6}$$
$$\dfrac{r(n-r)!}{(n-r+1)!}=\dfrac{1}{6}$$
$$\dfrac{r}{n+1-r}=\dfrac{1}{6}$$
$$n-7r+1=0$$ .....(2)
Solving equations 1 & 2, we get,
$$r=8$$ and $$n=55$$
Hence, $$n=55$$