Problem

Source: 2020 Estonia TST 4.3

Tags: number theory, remainder



The prime numbers p and q and the integer a are chosen such that p>2 and a (mod q), but a^p \equiv 1 (mod q). Prove that (1 + a^1)(1 + a^2)...(1 + a^{p - 1})\equiv 1 (mod q) .