2022 SSMO Accuracy Round Problems/Problem 5

Problem

Find the number of ordered pairs $(a, b)$, where $1\leq a, b\leq 9$, for which the largest integer $n$ that satisfies\[(a-b)^k\equiv a^k-b^k\pmod n\]for all $k\geq 1$ is $ab-b^2$.

Solution