Steply

Calculate 2^20 mod 3

Step by step, with the reason for every step · Powers mod n, last digits · Discrete Math

Step by step

The question

Question: find 2²⁰ mod 3.

220 mod 3

2 to the power 20 has 7 digits.

Too big to work out by hand.

220 has 7 digits!

1 Small powers first

Let's make a table of small powers.

Each one is the one before times 2.

We only keep the remainder: the big part never matters.

only the remainder matters

2 to the 1 is 2.

2
2

Then 2 times 2 is 4.

2 × 2 = 4

4 mod 3 is 1.

And so on.

1
1 × 2 = 2
2

2 Find the pattern

At k = 3 we are back to 2.

From here everything repeats.

So the pattern 2, 1 repeats every 2 powers.

repeats every 2: 2, 1, 2, 1, ...

3 Where 20 lands

20 divided by 2: 10 full patterns, and 0 left over.

20 = 2 × 10 + 0

Careful!

Nothing left over means we end at the end of a pattern: the same place as k = 2.

Careful: not k = 0 ✗

So 2 to the 20 is like k = 2: the last one of the pattern.

So 2²⁰ mod 3 is 1.

220 mod 3 = 1

4 Check

A computer can work out all 7 digits: 1048576.

computer: 220 = 1048576

Divided by 3, it leaves 1, the same as our pattern.

Right!

÷ 3: remainder 1

Let's look back.

First: small powers first.

Then: find the pattern.

Then: where 20 lands.

Last: check.

Answer
220 mod 3 = 1

Your turn

Try this one yourself, then check:

526 mod 3
Show the answer
5²⁶ mod 3 = 1

More from Powers mod n, last digits

The whole lesson: Powers mod n, last digits →