For how many positive integers n ≤ 1000 is n² + n + 1 divisible by 7?
Type in the answer (TITA): no options.
Show answer & solution
Correct answer: 286
Solution: Check residues mod 7: n ≡ 0,1,2,3,4,5,6 give n² + n + 1 ≡ 1, 3, 0, 6, 0, 3, 1. So 7 divides it exactly when n ≡ 2 or 4 (mod 7). 1000 = 7 × 142 + 6, so each residue class appears 142 times in 1..994, and 995..1000 have residues 1..6, which include 2 and 4 once each. Total = 2 × 142 + 2 = 286.