DR.WANG Mathematics中文

2024 AIME II · Question 7

Number theory · modular arithmetic · digits · optimization · problem-solving

Problem outline

Find the largest four-digit number NN for which replacing any single digit by 11 gives a multiple of seven. Write N=1000Q+RN=1000Q+R with 0≤R<10000\le R<1000 and find Q+RQ+R.

Show answer and methods 1 methods

Answer

699

Method 1 Recover the residue shared by the four digit changes

Let djd_j be the digit at 10j10^j and let r=N mod 7r=N\bmod7. All four replacements work iff (dj−1)10j≡r(mod7)(d_j-1)10^j\equiv r\pmod7 for every jj. Since N=1111+∑(dj−1)10jN=1111+\sum(d_j-1)10^j, we get r≡5+4rr\equiv5+4r, hence r=3r=3.

The powers 10j10^j for j=0,1,2,3j=0,1,2,3 are congruent to 1,3,2,61,3,2,6. The corresponding digits are congruent to 4,2,6,54,2,6,5. Taking the greatest decimal digit in each class produces 56945694. These congruences also imply N≡3N\equiv3, validating all replacements. Thus Q+R=5+694=699Q+R=5+694=699.

Source and attribution

The outline and worked methods on this page were prepared for DR.WANG Mathematics.

Original question (external)