8. Let $\varphi(n)$ denote the number of positive integers not exceeding $n$ that are coprime to $n$, and $g(n)$ satisfies that for any $n \in \mathbf{Z}_{+}$, $\sum_{d \| n} g(d)=\varphi(n)$, where $\sum_{d \| n}$ indicates that $d$ takes all positive divisors of $n$. Then $g(50)=$ $\qquad$
8. 0 .

It is known that $g(1)=1, g(2)=0$.
From $4=\varphi(5)=g(1)+g(5)$
$$
\Rightarrow g(5)=3 \text {; }
$$

From $4=\varphi(10)=g(1)+g(2)+g(5)+g(10)$
$$
\Rightarrow g(10)=0 \text {; }
$$

From $20=\varphi(25)=g(1)+g(5)+g(25)$
$$
\Rightarrow g(25)=16 \text {. }
$$

Thus $20=\varphi(50)$
$$
\begin{array}{l}
=g(1)+g(5)+g(5)+g(10)+g(25)+g(50) \\
\Rightarrow g(50)=0 .
\end{array}
$$