4. Given the sequence $\left\{a_{n}\right\}$, where $a_{1}=99^{\frac{1}{99}}, a_{n}=$ $\left(a_{n-1}\right)^{a_{1}}$. When $a_{n}$ is an integer, the smallest positive integer $n$ is $\qquad$
4. 100 .

Obviously, for any positive integer $n$, we have $a_{n}>0$.
From $a_{n}=\left(a_{n-1}\right)^{a_{1}}$, taking the common logarithm on both sides, we get
$\lg a_{n}=a_{1} \lg a_{n-1}$.
Therefore, $\left\{\lg a_{n}\right\}$ is a geometric sequence with the first term $\lg a_{1}$ and the common ratio $a_{1}$. So, $\lg a_{n}=a_{1}^{n-1} \lg a_{1}$, which gives
$$
a_{n}=a_{1}^{a_{1}^{n-1}}=\left(99^{\frac{1}{9}}\right)^{\frac{1}{99_{9}^{9}}(n-1)}
$$

To make $a_{n}$ an integer, it is necessary that $n-1=99 k$ (where $k$ is a positive integer).
Therefore, the smallest positive integer $n$ is 100.