Let $d(n)$ denote the number of positive divisors of $n$. Find all triples $(n, k, p)$, where $n$ and $k$ are positive integers and $p$ is a prime number, such that

$$
n^{d(n)}-1=p^{k} .
$$
Note first that $n^{d(n)}$ is always a square: if $d(n)$ is an even number this is clear; but $d(n)$ is odd exactly if $n$ is a square, and then its power $n^{d(n)}$ is also a square.

Let $n^{d(n)}=m^{2}, m>0$. Then

$$
(m+1)(m-1)=m^{2}-1=n^{d(n)}-1=p^{k} .
$$

There is no solution for $m=1$. If $m=2$, we get $(n, k, p)=(2,1,3)$. If $m>2$, we have $m-1, m+1>1$ and because both factors divide $p^{k}$, they are both powers of $p$. The only possibility is $m-1=2, m+1=4$. Hence $m=3$ and $n^{d(n)}=m^{2}=9$. This leads to the solution $(n, k, p)=(3,3,2)$. So the only solutions are $(n, k, p)=(2,1,3)$ and $(n, k, p)=(3,3,2)$.