Find general term of a recurrent sequence If $a_1=6$ and $a_{n+1}= \frac{1}{18}(2a_n-1+\sqrt{8a_n+1}), n\geq1$ expressed $a_n$ in the function of $n$.
My attempt: We calculated the first 5 terms of the series, but I was unable to determine the desired formula and then apply mathematical induction.

We note that the terms are (perhaps surprisingly) all rational. As such, we posit that the square root will always evaluate to a rational number, i.e. that $8a_n+1=b_n^2$, where $b_n$ is rational. Let's work through the algebra of this substitution:
$$\frac{b_{n+1}^2-1}{8}=\frac{2(\frac{b_{n}^2-1}{8})-1+b_n}{18}$$
$$b_{n+1}^2-1=\frac{2(b_n^2-1)-8+8b_n}{18}$$
$$b_{n+1}^2=\frac{2b_n^2+8b_n+8}{18}=\frac{b_n^2+4b_n+4}{9}=(\frac{b_n+2}{3})^2$$
So, $b_{n+1}=\frac{b_n+2}{3}\implies b_{n+1}-1=(b_n-1)/3$. Some backtracking tells us that $b_1-1=7-1=6$, whence we see that $b_n-1=\frac{6}{3^{n-1}}$. We then see:
$$b_n=1+\frac{18}{3^n}$$
Some algebra using $a_n=\frac{b_n^2-1}{8}$ ultimately gets us to $a_n=\frac{3^{2-n}+3^{2(2-n)}}{2}$, and we are done here.
