Problem

Source: ELMO Shortlist 2011, N4; also ELMO #5

Tags: modular arithmetic, quadratics, number theory proposed, number theory



Let $p>13$ be a prime of the form $2q+1$, where $q$ is prime. Find the number of ordered pairs of integers $(m,n)$ such that $0\le m<n<p-1$ and \[3^m+(-12)^m\equiv 3^n+(-12)^n\pmod{p}.\] Alex Zhu.

HIDE: Note The original version asked for the number of solutions to $2^m+3^n\equiv 2^n+3^n\pmod{p}$ (still $0\le m<n<p-1$), where $p$ is a Fermat prime.