JEE Main 2022 — 26 June, Shift 1. Previous Year Question.
Problem
The remainder when $(2021)^{2023}$ is divided by $7$ is?
Key insight. There’s no need to touch a 2021-digit-scale number directly. Reduce the base modulo 7 first, then hunt for a power of the reduced base that lands on remainder $-1$ (equivalently $6$) — because $(-1)$ raised to anything keeps behaving predictably, turning a huge exponent into a small one.
Watch this explained step by step → · More on the Shiwam’s Classes channel
Approach
First replace 2021 with its remainder on division by 7, since only the remainder matters for the rest of the calculation. Then look for a small power of that remainder which itself leaves remainder $-1$ (mod 7) — once found, break the huge exponent 2023 into a multiple of that small power plus a leftover, so the whole expression collapses to $(-1)^{\text{something}} \times (\text{small leftover power})$.
Solution
Step 1 — Reduce the base modulo 7
$$2021 = 7 \times 288 + 5 \implies 2021 \equiv 5 \pmod{7}$$
So the problem becomes: find $5^{2023} \bmod 7$.
Step 2 — Find a power of 5 that gives remainder $-1$
$$5^3 = 125 = 7 \times 17 + 6 \implies 5^3 \equiv 6 \equiv -1 \pmod 7$$
This is the useful pattern: $5^3 \equiv -1 \pmod 7$, and $(-1)$ raised to any power is easy to track.
Step 3 — Break 2023 in terms of multiples of 3
$$2023 = 3 \times 674 + 1$$
So:
$$5^{2023} = \left(5^3\right)^{674} \times 5^1$$
Step 4 — Simplify using the known remainder
$$5^{2023} \equiv (-1)^{674} \times 5 \pmod 7$$
Since $674$ is even, $(-1)^{674} = 1$:
$$5^{2023} \equiv 1 \times 5 = 5 \pmod 7$$
Answer
$$5$$
Common mistakes
- Trying to spot a pattern using powers of 5 directly (remainders $5, 4, 6, 2, 3, 1, \ldots$ repeating every 6) instead of noticing the shortcut that $5^3 \equiv -1$. The direct cycle-of-6 approach also works, but tracking $-1$ is faster and less error-prone here.
- Forgetting to reduce the base first. Working with $2021^{2023}$ directly instead of $5^{2023}$ makes every subsequent step needlessly large.
Practise next
- Find the remainder when $2023^{2021}$ is divided by 7, using the same reduce-the-base-first approach.
Show answer
$0$. Reduce the base before doing anything else: $2023=7\times289$, so $2023\equiv0\pmod 7$.
Hence $2023^{2021}\equiv0^{2021}=0\pmod 7$ — the remainder is $0$, with no binomial expansion or Fermat’s little theorem needed.
This is exactly why the base is reduced first. Reaching for cycles of powers before checking divisibility wastes the whole calculation.

Doubts are answered by Shiwam, usually within a day. Ask about this question specifically — a general question about the chapter is better asked in class.