17. $(\mathbf{C Z E})^{\mathrm{IMO} 5}$ Find all pairs of integers $x, y \geq 1$ satisfying the equation $x^{y^{2}}=y^{x}$.
17. We note first that \(x\) and \(y\) must be powers of the same positive integer. Indeed, if \(x = p_1^{\alpha_1} \cdots p_k^{\alpha_k}\) and \(y = p_1^{\beta_1} \cdots p_k^{\beta_k}\) (some of \(\alpha_i\) and \(\beta_i\) may be 0, but not both for the same index \(i\)), then \(x^{y^2} = y^x\) implies \(\frac{\alpha_i}{\beta_i} = \frac{x}{y^2} = \frac{p}{q}\) for some \(p, q > 0\) with \(\gcd(p, q) = 1\), so for \(a = p_1^{\alpha_1 / p} \cdots p_k^{\alpha_k / p}\) we can take \(x = a^p\) and \(y = a^q\). If \(a = 1\), then \((x, y) = (1, 1)\) is the trivial solution. Let \(a > 1\). The given equation becomes \(a^{p a^{2q}} = a^{q a^p}\), which reduces to \(p a^{2q} = q a^p\). Hence \(p \neq q\), so we distinguish two cases: (i) \(p > q\). Then from \(a^{2q} > q\), we can rewrite the equation as \(p = a^{p-2q} q\), and putting \(p = 2q + d\), \(d > 0\), we obtain \(d = q(a^d - 2)\). By induction, \(2^d - 2 > d\) for each \(d > 2\), so we must have \(d \leq 2\). For \(d = 1\) we get \(q = 1\) and \(a = p = 3\), and therefore \((x, y) = (27, 3)\), which is indeed a solution. For \(d = 2\) we get \(q = 1\), \(a = 2\), and \(p = 4\), so \((x, y) = (16, 2)\), which is another solution. (ii) \(p < q\). Then from \(a^{2q} < q\), this is transformed to \(a^d = a^{(2a^d - 1)p}\), or equivalently to \(d = (2a^d - 1)p\). However, this equality cannot hold, because \(2a^d - 1 > d\) for each \(a \geq 2\), \(d \geq 1\). The only solutions are thus \((1, 1)\), \((16, 2)\), and \((27, 3)\).