The Last Two Digits of 7 to the 2024th

  • Hard
  • Number puzzles
  • Tests: Finding the cycle length of a remainder

The puzzle

What are the last two digits of 7^2024?

You cannot compute the number - it has over 1,700 digits - so find the pattern instead.

Stuck?

One at a time, smallest first. Open only as many as you need — the whole point of the puzzle is the part you work out yourself.

Hint 1

List the last two digits of 7, 7^2, 7^3, 7^4, 7^5 and stop when something repeats.

Hint 2

07, 49, 43, 01, 07, ... the cycle is four long.

Show the answer Hide the answer

01. Since 2024 is exactly 506 complete cycles of four, 7^2024 ends in 01.

How to get there

Work modulo 100 - that is, keep only the last two digits at each step. 7^1 = 07, 7^2 = 49, 7^3 = 343 so 43, 7^4 = 43 x 7 = 301 so 01.

Hitting 01 means the pattern restarts: 7^5 ends in 07, 7^6 in 49, and so on with period 4.

So the last two digits depend only on 2024 modulo 4. 2024 / 4 = 506 exactly, with no remainder, so 7^2024 sits at the end of a cycle, exactly where 7^4 does: it ends in 01. Had the exponent been 2025 the answer would be 07, and 2026 would give 49.

The technique worth keeping

Powers modulo m always cycle. Compute the first few, note where the cycle closes, then reduce the exponent modulo that length - the whole of modular exponentiation in one habit.