Maclaurin 2020 Q5
5. Let \(p\) and \(q\) respectively be the smallest and largest prime factors of \(n\). Find all positive integers \(n\) such that \(p^2 + q^2 = n + 9\).
Maclaurin Olympiad 2020, Question 5. © UK Mathematics Trust. Original paper on ukmt.org.uk
Answer: \(n = 9\) and \(n = 20\)
First eliminate the special case where \(n = p = q\) , which leads to \(2p^2 = p + 9\). This has no integer solutions.
Rewrite the equation as \(p^2 + q^2 - 9 = kpq\) for some positive integer \(k\)
Now, since \(q \mid q^2\) and \(q \mid kpq\), we have \(q \mid p^2 - 9 = (p - 3)(p + 3)\) and, since \(q\) is prime, \(q \mid p - 3\) or \(q \mid p + 3\)
Hence either \(p = 3\) or \(q \mid p + 3\)
If \(p = 3\) then \(n = q^2\) and \(3 \mid n\) so \(q = 3\) and \(n = 9\), which works.
If \(q \mid p + 3\) and \(p = 2\) then \(q = 5\) and \(n = 20\) , which works.
If \(p > 3\) then \(q > \tfrac{p+3}{2}\) and so \(q = p + 3\), which is even. So this is impossible.
Hence only solutions are \(n = 9\) and \(n = 20\).
An alternative approach, using modular arithmetic, observes that \(p^2 \equiv 9 \pmod{q}\)
Since \(q\) is prime, this implies that \(p \equiv \pm 3 \pmod{q}\) and then proceeds as above.
Solution © UK Mathematics Trust, from the Maclaurin Olympiad 2020 solutions.