Math Core

Module 3.5 · Number Theory

Remainders

"What is the remainder when 31003^{100} is divided by 77?" The number 31003^{100} has 4848 digits, but you never need to compute it. Remainders follow simple arithmetic rules of their own, so you can throw away everything except the remainders and work with small numbers the whole time.

The basic rules

When you divide nn by mm, you get a quotient qq and a remainder rr with n=qm+rn = qm + r and 0≤r<m0 \le r < m. For example, 47=6⋅7+547 = 6 \cdot 7 + 5, so 4747 leaves remainder 55 when divided by 77.

Replace numbers by their remainders

When you add, subtract or multiply whole numbers, the remainder of the result (on division by mm) depends only on the remainders of the numbers you started with. So you may replace any number by its remainder at any step.

Why it works. Say a=7s+3a = 7s + 3 and b=7t+5b = 7t + 5. Then a⋅b=49st+35s+21t+15.a \cdot b = 49st + 35s + 21t + 15. Every term except 1515 is a multiple of 77, so abab has the same remainder as 3⋅5=153 \cdot 5 = 15, namely 11. Sums work the same way.

Many contest writers use the notation a≡b(modm)a \equiv b \pmod{m} ("aa is congruent to bb mod mm") to mean aa and bb leave the same remainder when divided by mm. For example, 47≡5(mod7)47 \equiv 5 \pmod 7.

Worked example: A big product

What is the remainder when 1234×56781234 \times 5678 is divided by 99?

A number and its digit sum leave the same remainder on division by 99. 12341234 has digit sum 1010, remainder 11. 56785678 has digit sum 2626, remainder 88. So the product leaves remainder 1⋅8=81 \cdot 8 = 8.

Powers: look for a 1

To find the remainder of a huge power, compute small powers until the remainder is 11. After that, the pattern repeats.

Worked example: A huge power

What is the remainder when 31003^{100} is divided by 77?

Remainders of 31,32,33,…3^1, 3^2, 3^3, \dots divided by 77: 3,2,6,4,5,13, 2, 6, 4, 5, 1. So 363^6 leaves remainder 11. Since 100=6⋅16+4100 = 6 \cdot 16 + 4, 3100=(36)16⋅34,3^{100} = (3^6)^{16} \cdot 3^4, which has the same remainder as 116⋅34=811^{16} \cdot 3^4 = 81. And 81=11⋅7+481 = 11 \cdot 7 + 4, so the remainder is 4.

Tip

Days of the week are remainders on division by 77. A date 100100 days from a Saturday is 100=14⋅7+2100 = 14 \cdot 7 + 2 days later, so it falls 22 days after Saturday: Monday. And because 365=52⋅7+1365 = 52 \cdot 7 + 1, a date moves forward one weekday each ordinary year.

Several conditions at once

Worked example: One less than a multiple

What is the smallest positive integer that leaves remainder 33 when divided by 44, remainder 44 when divided by 55, and remainder 55 when divided by 66?

Each remainder is one less than the divisor. So n+1n + 1 is divisible by 44, 55 and 66, meaning n+1n + 1 is a multiple of lcm⁡(4,5,6)=60\operatorname{lcm}(4, 5, 6) = 60. The smallest is n+1=60n + 1 = 60, so n=59n = 59.

When there's no such pattern, list the numbers that satisfy the condition with the largest divisor and test them against the others.

Worked example: Listing

Find the smallest positive integer that leaves remainder 22 when divided by 55 and remainder 33 when divided by 77.

Numbers with remainder 33 mod 77: 3,10,17,24,…3, 10, 17, 24, \dots Their remainders mod 55: 3,0,23, 0, 2. So the answer is 1717. (All solutions are 17+35k17 + 35k.)

Common mistake

A remainder can never be negative or as large as the divisor. If your work gives −2-2 when dividing by 77, add 77 to get the true remainder, 55.

Practice

Practice 1

What is the remainder when 20262026 is divided by 99?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 2

What is the remainder when 1+2+3+⋯+1001 + 2 + 3 + \dots + 100 is divided by 77?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 3

What is the remainder when 123×456×789123 \times 456 \times 789 is divided by 55?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 4

A whole number nn leaves remainder 55 when divided by 88. What is the remainder when 3n+73n + 7 is divided by 88?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 5

Today is Saturday. What day of the week will it be 100100 days from today?

Practice 6

What is the remainder when 2502^{50} is divided by 77?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 7

What is the smallest positive integer that leaves remainder 11 when divided by 33, remainder 22 when divided by 44, and remainder 33 when divided by 55?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 8

What is the remainder when 1!+2!+3!+⋯+50!1! + 2! + 3! + \dots + 50! is divided by 1212?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 9

What is the remainder when 31003^{100} is divided by 1313?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Real contest practice