Maths WorkshopMaths problems with full solutions
Exercise 619Number theory › CongruencesOlympiadAdded 4 Nov 2026

8k + 7 is not a sum of three squares

#squares modulo 8#representation by squares

Statement

Prove that no integer of the form 8k+78k+7 is a sum of three squares of integers.

Hint

What are the possible values of a square modulo 88?

Show solutionHide solution

Solution

Squares modulo 8. For xx odd, x2≡1(mod8)x^2\equiv1\pmod8; for x≡2,6(mod8)x\equiv2,6\pmod8, x2≡4x^2\equiv4; for x≡0,4(mod8)x\equiv0,4\pmod8, x2≡0x^2\equiv0. So squares are 0,1,40,1,4 modulo 88.

Sums of three. The sums of three elements of {0,1,4}\{0,1,4\} are:
0, 1, 2, 3, 4, 5, 6, 8≡0, 9≡1, 12≡4.0,\ 1,\ 2,\ 3,\ 4,\ 5,\ 6,\ 8\equiv0,\ 9\equiv1,\ 12\equiv4.
Precisely, the possible sums are the residues 0,1,2,3,4,5,60,1,2,3,4,5,6 modulo 88. The residue 77 is never obtained (for instance 4+1+1=64+1+1=6, 4+4+1=9≡14+4+1=9\equiv1, 1+1+1=31+1+1=3).

Conclusion. No sum of three squares is ≡7(mod8)\equiv7\pmod8.

Remark. Legendre's three-square theorem states the converse: a positive integer is a sum of three squares iff it is not of the form 4a(8b+7)4^a(8b+7). For example 1515, 2323, 28=4⋅728=4\cdot7 are not sums of three squares.

Lesson. List the residues of squares modulo 88 (0,1,40,1,4) and check which sums are attainable: the standard way to rule out representations.