4. Determine all pairs of positive integers $(n, p)$, satisfying:
' $p$ is a prime, $n \leqslant 2 p$, and $(p-1)^{n}+1$ is divisible by $n^{p-1}$.
Solution: Clearly, $(1, p)$ and $(2,2)$ satisfy the problem. Therefore, we consider the case where $n \geqslant 2, p \geqslant 3$ below.

Since $(p-1)^{n}+1$ is odd, $n$ must also be odd, hence $n<2 p$. Let $q$ be the smallest prime divisor of $n$, then $q \mid(p-1)^{n}+1$, so $(p-1)^{n} \equiv-1(\bmod q)$, and $(q, p-1)=1$. By the choice of $q$, we have $(n, p-1)=1$, thus there exist integers $u, v$ such that
$$
u n+v(q-1)=1 \text {. }
$$

According to Fermat's Little Theorem,
$$
\begin{aligned}
p-1 & \equiv(p-1)^{u n} \cdot(p-1)^{n(q-1)} \\
& \equiv(-1)^{u} \cdot 1^{v}(\bmod q) .
\end{aligned}
$$

Since $u$ must be odd, we have $p-1 \equiv-1$ $(\bmod q)$. This implies $q \mid p$, hence $q=p$. Therefore, we have $n=p$.
Thus, we obtain
$$
\begin{array}{l} 
p^{p-1} \\
= p^{2}(p-1)^{p}+1 \\
p^{p-2}-\binom{p}{1} p^{p-3}+\cdots+\binom{p}{p-3} p \\
\left.-\binom{p}{p-2}+1\right) .
\end{array}
$$

In the expression above, except for the last term, all terms are divisible by $p$. This implies $p-1 \leqslant 2$, hence $p=3$.

In summary, all solutions are $(2,2),(3,3)$, and $(1, p)$, where $p$ is any prime number.