8. Let the function
$$
f(x)=a_{0}+a_{1} x+a_{2} x^{2}+\cdots+a_{n} x^{n},
$$

where $a_{0}, a_{1}, \cdots, a_{n}$ are non-negative integers. It is known that $f(1)=4$, $f(5)=152$. Then $f(6)=$ $\qquad$
8. 254.

Notice that $a_{i}(i=0,1, \cdots, n)$ are all non-negative integers. From $f(5)=152$, we know $a_{0} \equiv 2(\bmod 5)$; 
from $f(1)=4$, we know $a_{0}+a_{1}+\cdots+a_{n}=4$.
Thus, $a_{0}=2$, and for $1 \leqslant i \leqslant n$, we have $a_{i} \leqslant 2$.
Also, since $5^{4}>152=f(5)$, we know
$$
\begin{array}{l}
a_{4}=a_{5}=\cdots=a_{n}=0 . \\
\text { Then }\left\{\begin{array}{l}
2+5 a_{1}+5^{2} a_{2}+5^{3} a_{3}=152, \\
2+a_{1}+a_{2}+a_{3}=4
\end{array}\right. \\
\Rightarrow a_{2}+6 a_{3}=7 .
\end{array}
$$

Since $a_{i}$ are non-negative integers, we have
$$
a_{2}=a_{3}=1, a_{1}=0 \text {. }
$$

Thus, $f(x)=2+x^{2}+x^{3}$.
Therefore, $f(6)=2+6^{2}+6^{3}=254$.