8. Let $\frac{1}{1-x-x^{2}-x^{3}}=\sum_{i=0}^{\infty} a_{n} x^{n}$. If $a_{n-1}=n^{2}$, then the set of values for $n$ is . $\qquad$
8. $\{1,9\}$.

Multiplying both sides of the given equation by $1-x-x^{2}-x^{3}$, we get
$$
1=a_{0}+\left(a_{1}-a_{0}\right) x+\left(a_{2}-a_{1}-a_{0}\right) x^{2}+\cdots \text {. }
$$

By comparing coefficients, we obtain
$$
\begin{array}{l}
a_{0}=1, a_{1}=1, a_{2}=2, \\
a_{n}=a_{n-1}+a_{n-2}+a_{n-3}(n \geqslant 3) .
\end{array}
$$

Thus, the initial terms of the sequence $\left\{a_{n}\right\}$ are:
$$
1,1,2,4,7,13,24,44,81,149, \cdots \text {. }
$$

Hence, $a_{1}=1^{2}, a_{8}=9^{2}$.
Next, we prove that for larger $n$, there will be no term satisfying $a_{n-1}=n^{2}$.
This can be shown by proving: $a_{n}>\left(\frac{3}{2}\right)^{n}(n \geqslant 3)$.
In fact, when $n \geqslant 6$, it always holds that $\frac{n^{2}}{(n-1)^{2}}n^{2}$; when $n>10$, there will be no term satisfying $a_{n-1}=n^{2}$.
We will prove this by mathematical induction.
For $n=3,4,5$, the conclusion is obviously true.
Assume that the conclusion holds for $n \leqslant k$. Then
$$
\begin{aligned}
a_{k+1} & =a_{k}+a_{k-1}+a_{k-2} \\
& >\left(\frac{3}{2}\right)^{k}+\left(\frac{3}{2}\right)^{k-1}+\left(\frac{3}{2}\right)^{k-2} \\
& =\left(\frac{3}{2}\right)^{k-2}\left[1+\frac{3}{2}+\left(\frac{3}{2}\right)^{2}\right]>\left(\frac{3}{2}\right)^{k+1} .
\end{aligned}
$$

Therefore, for $n \geqslant 3$, we have $a_{n}>\left(\frac{3}{2}\right)^{n}$.
In summary, the set of values of $n$ that satisfy the condition is $\{1,9\}$.