8. For a positive integer $n$, let $S(n)$ denote the sum of the digits of $n$, and let $\varphi(n)$ denote the number of positive integers less than $n$ that are coprime to $n$. If $n$ is a three-digit number and satisfies $n=34 S(n)$, then the maximum value of $\varphi(n)$ is $\qquad$
8. 128 .

Let the three-digit number be
$$
n=100 a+10 b+c,
$$

where $a, b, c \in\{0,1, \cdots, 9\}, a>0$.
Then $100 a+10 b+c=34(a+b+c)$,
$$
8 b=22 a-11 c=11(2 a-c) .
$$

But $(8,11)=1$, so $11 \mid b \Rightarrow b=0$.
Thus, $2 a-c=0$.
When $a=1$, $c=2, n=102$;
When $a=2$, $c=4, n=204$;
When $a=3$, $c=6, n=306$;
When $a=4$, $c=8, n=408$.
Therefore, the maximum value of $\varphi(n)$ is
$$
\begin{array}{l}
\varphi(408)=\varphi\left(2^{3} \times 3 \times 17\right) \\
=408\left(1-\frac{1}{2}\right)\left(1-\frac{1}{3}\right)\left(1-\frac{1}{17}\right)=128 .
\end{array}
$$