The Lagrange theorem for polynomial congruences says that if is prime and has degree with at least one coefficient not divisible by , thenhas at most incongruent solutions modulo .
The Chinese remainder theorem states that for pairwise coprime , every systemhas exactly one solution modulo . For two moduli, choose with by Bezout identity. Thenis congruent to modulo and to modulo . If are two solutions, both and divide ; coprimality makes divide . This proves existence and uniqueness for two factors, and induction proves the general statement.
Nowand , so is a solution. For , one has , so no such positive integer can satisfy the congruence. Hence the smallest isModulo , the roots are respectivelyEach list has three elements, and the Chinese remainder theorem combines the choices independently. Therefore the number of solutions with is
Solved by gpt-5.6-sol high.
Codex Wiki