(IMO 97 exo 5) find the integers $a, b \geq 1$ such that

$$
a^{b^{2}}=b^{a}
$$
Let $d=\operatorname{gcd}(a, b)$ and write $a=d u$ and $b=d v$ with $u$ and $v$ coprime. The equation becomes $(d u)^{d v^{2}}=(d v)^{u}$. Let's study several cases depending on the values of $u$ and $d v^{2}$:

First case: $d v^{2}=u$ in this case $v \mid u$ and thus $v=1, u=d$ and $d^{2 d}=d^{d}$, so $d=1$. Therefore, we have the solution $a=1, b=1$.

![](https://cdn.mathpix.com/cropped/2024_05_10_8c44cd8b5c585c15e58bg-115.jpg?height=63&width=1402&top_left_y=1990&top_left_x=201)
$u=1$. The case $d=1$ gives the same solution $(1,1)$ as before. If $d \geq 2$, $d^{d v^{2}-1} \geq 2^{2 v^{2}-1}>v$, there is no solution.

Third case: $d v^{2} > d$, i.e., $u > 2 d$. Let $p$ be a prime and $\alpha=v_{p}(u), \beta=v_{p}(d)$ the $p$-adic valuations. Then we have $\alpha d = \beta(u-d)$, so $\alpha > \beta$. This is true for all prime numbers, so $u$ is a multiple of $d$. Write $u=k d$, the equation becomes $k=d^{k-2}$.

We know that $k \geq 3$ since $u > 2 d$. If $k=3$, we have $d=3$ and $a=27, b=3$. If $k=4$, we have $d=2$ and $a=16, b=2$. If $k \geq 5$, then $d^{k-2} \geq 2^{k-2} > k$ and there are no more solutions. In conclusion, the solutions are $(1,1),(2,16),(3,27)$.