Find the formula for the sequence $(a_n)$ that satisfies the recurrence relation $a_n=(n+7)a_{n-1}+n^2$ with the initial condition $a_0=1$.
This is a non-linear nonhomogeneous recurrence relation. What I can think that may help solve this problem is using the idea of generating function.
Let $G(x)=\sum_{n=0}^{\infty}a_nx^n$. Then
$$\begin{aligned}
G(x)&=a_0+\sum_{n=1}^{\infty}a_nx^n\\
&=1+\sum_{n=1}^{\infty}\left((n+7)a_{n-1}+n^2\right)x^n\\
&=1+\sum_{n=1}^{\infty}\left((n+7)a_{n-1}x^n\right)+\sum_{n=1}^{\infty}(n^2x^n)
\end{aligned}$$
Then I was stuck here, because I couldn't change the two summations into forms of $G(x)$.
Anyone has brillant ideas?
Following @GTonyJacobs remark about the homogeneous sequence, let us define (this is a discrete method of variation of the parameter)
$${a}_{n} = \left(n+7\right) ! \ {b}_{n}$$
We have
$$\left(n+7\right) ! \ {b}_{n} = \left(n+7\right) \left(n+6\right) ! \ {b}_{n-1}+{n}^{2}$$
hence
$${b}_{n}-{b}_{n-1} = \frac{{n}^{2}}{\left(n+7\right) ! \ }$$
It follows that
$${b}_{n} = {b}_{0}+\sum _{k = 1}^{n} \left({b}_{k}-{b}_{k-1}\right) = \frac{1}{7 ! \ }+\sum _{k = 1}^{n} \frac{{k}^{2}}{\left(k+7\right) ! \ }$$
hence
$${a}_{n} = \left(n+7\right) ! \ \left(\frac{1}{7 ! \ }+\sum _{k = 1}^{n} \frac{{k}^{2}}{\left(k+7\right) ! \ }\right)$$