Steply

Calculate 3^100 mod 5

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

Step by step

The question

Question: find 3¹⁰⁰ mod 5.

3100 mod 5

3 to the power 100 has 48 digits.

Too big to work out by hand.

3100 has 48 digits!

1 Small powers first

Let's make a table of small powers.

Each one is the one before times 3.

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

only the remainder matters

3 to the 1 is 3.

3
3

Then 3 times 3 is 9.

3 × 3 = 9

9 mod 5 is 4.

And so on.

4
4 × 3 = 12
2
2 × 3 = 6
1
1 × 3 = 3
3

2 Find the pattern

At k = 5 we are back to 3.

From here everything repeats.

So the pattern 3, 4, 2, 1 repeats every 4 powers.

repeats every 4: 3, 4, 2, 1, 3, 4, 2, 1, ...

3 Where 100 lands

100 divided by 4: 25 full patterns, and 0 left over.

100 = 4 × 25 + 0

Careful!

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

Careful: not k = 0 ✗

So 3 to the 100 is like k = 4: the last one of the pattern.

So 3¹⁰⁰ mod 5 is 1.

3100 mod 5 = 1

4 Check

A computer can work out all 48 digits: 515377, and so on, 2001.

computer: 3100 = 515377...2001

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

Right!

÷ 5: remainder 1

Let's look back.

First: small powers first.

Then: find the pattern.

Then: where 100 lands.

Last: check.

Answer
3100 mod 5 = 1

Your turn

Try this one yourself, then check:

976 mod 5
Show the answer
9⁷⁶ mod 5 = 1

More from Powers mod n, last digits

The whole lesson: Powers mod n, last digits →