Step by step
The question
Question: find 6²⁵ mod 7.
6 to the power 25 has 20 digits.
Too big to work out by hand.
1 Small powers first
Let's make a table of small powers.
Each one is the one before times 6.
We only keep the remainder: the big part never matters.
6 to the 1 is 6.
Then 6 times 6 is 36.
36 mod 7 is 1.
And so on.
2 Find the pattern
At k = 3 we are back to 6.
From here everything repeats.
So the pattern 6, 1 repeats every 2 powers.
3 Where 25 lands
25 divided by 2: 12 full patterns, and 1 left over.
Careful!
The pattern is all we need.
The full number is far too big.
So 6 to the 25 is like k = 1.
So 6²⁵ mod 7 is 6.
4 Check
A computer can work out all 20 digits: 284302, and so on, 1376.
Divided by 7, it leaves 6, the same as our pattern.
Right!
Let's look back.
First: small powers first.
Then: find the pattern.
Then: where 25 lands.
Last: check.