Sub topic 13
Units Digits and Repeating Power Cycles
This chapter assumes you can compute remainders (n = dq + r), know that the units digit of n is the remainder of n divided by 10, and can use exponent notation. The units digit is the last digit of a positive integer. For example, the units digit of 4,917 is 7.
Why units digits are easy to find
The units digit of a sum, difference, or product depends only on the units digits of the numbers involved. This is the remainder rule from the previous chapter applied with divisor 10. To find the units digit of 17 × 23, you only need 7 × 3 = 21, so the units digit is 1.
Powers are repeated multiplication, so the same rule applies. Each time you multiply by the base, the new units digit depends only on the previous units digit and the units digit of the base. That makes the sequence of units digits of 7, 7², 7³, ... predictable, and it always repeats.
Building a cycle
Take the base 7 and track only the units digit:
- 7¹ = 7, so the units digit is 7.
- 7² = 49, so the units digit is 9.
- 7³ ends in 9 × 7 = 63, so the units digit is 3.
- 7⁴ ends in 3 × 7 = 21, so the units digit is 1.
- 7⁵ ends in 1 × 7 = 7, so the units digit is 7 again.
The digit 7 has returned, and each next step depends only on the current digit, so the pattern now repeats forever: 7, 9, 3, 1, 7, 9, 3, 1, ... The cycle length is 4.
Using the cycle for a large exponent
To find the units digit of 7¹⁰⁰, you need the position of exponent 100 inside the cycle. Divide the exponent by the cycle length and look at the remainder.
- Find the cycle for the base's units digit.
- Divide the exponent by the cycle length.
- If the remainder is r with 1 ≤ r ≤ length, take the r-th digit of the cycle.
- If the remainder is 0, take the last digit of the cycle (the digit at position equal to the cycle length).
Here 100 ÷ 4 = 25 with remainder 0, so 7¹⁰⁰ has the last digit of the cycle, which is 1.
print(pow(7, 100, 10)) # 1
print([pow(7, k, 10) for k in range(1, 5)]) # [7, 9, 3, 1]The call pow(7, 100, 10) computes 7¹⁰⁰ mod 10 directly, which is the units digit.
The remainder-0 case is the most common error. A remainder of 0 does not mean "no digit." It means the exponent is an exact multiple of the cycle length, so you land at the end of a full cycle.
Another example: the units digit of 7²⁰²⁶. Since 2026 = 4 × 506 + 2, the remainder is 2, and the second digit of the cycle is 9.
The cycles for every units digit
Only the units digit of the base matters. 13⁵⁰ and 3⁵⁰ have the same units digit, because 13 ≡ 3 (mod 10).
| Base units digit | Cycle of units digits | Cycle length |
|---|---|---|
| 0 | 0 | 1 |
| 1 | 1 | 1 |
| 2 | 2, 4, 8, 6 | 4 |
| 3 | 3, 9, 7, 1 | 4 |
| 4 | 4, 6 | 2 |
| 5 | 5 | 1 |
| 6 | 6 | 1 |
| 7 | 7, 9, 3, 1 | 4 |
| 8 | 8, 4, 2, 6 | 4 |
| 9 | 9, 1 | 2 |
Every cycle length is 1, 2, or 4. Because 1 and 2 both divide 4, you can use cycle length 4 for every base. The rule becomes: divide the exponent by 4, and use the remainder (with 0 read as 4) as the position in the length-4 version of the cycle. For bases such as 4, whose true cycle is 4, 6, you can write it as 4, 6, 4, 6 and the rule still works.
You do not need to memorize the table. You can rebuild any row in a few seconds by multiplying by the base and keeping only the last digit. Memorize only the idea that the cycle length divides 4.
def units_digit_power(base, exponent):
"""Units digit of base**exponent for exponent >= 1."""
return pow(base % 10, exponent, 10)
for b in range(10):
print(b, [units_digit_power(b, k) for k in range(1, 5)])This prints the first four units digits for every base from 0 through 9, which reproduces the table. One caveat: pow(0, 0, 10) is 1 in Python, so the formula is only meant for exponents of at least 1.
Edge cases
- Bases ending in 0, 1, 5, or 6. The units digit never changes. Any power of a number ending in 5 ends in 5, and any power of a number ending in 6 ends in 6.
- Negative bases. Work with the units digit of the positive value, then apply the sign afterward. The sign matters for parity, but a units digit is defined for the absolute value of an integer. If a question involves (−3)ⁿ, decide the sign from whether n is even or odd, and find the size from the cycle.
- Exponent of 0. Any nonzero base to the power 0 is 1, which breaks the "exponent ≥ 1" assumption. Check this case before using a cycle.
- Sums of powers. Find the units digit of each term separately, add them, and keep only the units digit of the total. For 3⁴⁰ + 7²⁰: 40 ÷ 4 leaves 0, so 3⁴⁰ ends in 1; 20 ÷ 4 leaves 0, so 7²⁰ ends in 1. The sum ends in 2.
- Powers of powers. In 2^(3⁴), the exponent is 3⁴ = 81, not 3 × 4. To find the units digit, find 81 mod 4 = 1, so 2⁸¹ ends in the first digit of the cycle, 2. If the exponent is itself huge, find the exponent's remainder mod 4 using the same techniques.
Beyond the units digit
The same cycle idea gives you the last two digits or the remainder on division by other numbers. Powers of any integer modulo any divisor eventually repeat, because there are only finitely many remainders. On the GRE, the units digit is by far the most common version. When a question asks for a remainder upon division by 3, 4, 5, or 9, look for a cycle in the same way: write the first several remainders and find where the pattern repeats.
For example, the remainder of 2ⁿ upon division by 3 alternates 2, 1, 2, 1, ... So 2⁵⁰ leaves remainder 1, because 50 is even.
Applying it in quantitative comparison
Quantitative comparison questions ask whether one quantity is greater, smaller, equal, or undetermined. Units digits often decide equality questions quickly.
Suppose Quantity A is the units digit of 3⁴³ and Quantity B is the units digit of 8²⁷.
- For 3⁴³: 43 = 4 × 10 + 3, so the remainder is 3 and the third digit of 3, 9, 7, 1 is 7.
- For 8²⁷: 27 = 4 × 6 + 3, so the remainder is 3 and the third digit of 8, 4, 2, 6 is 2.
Quantity A is 7 and Quantity B is 2, so A is greater. Note that this is a definite answer, because both quantities are fixed numbers. "Cannot be determined" is wrong whenever every value is fixed.
Common errors
- Reading a remainder of 0 as "position 0" instead of the last digit of the cycle.
- Using the exponent's units digit instead of its remainder on division by the cycle length. The units digit of the exponent is not enough: 7¹² and 7²² have exponents ending in 2 and 2, but 12 leaves remainder 0 on division by 4 and 22 leaves remainder 2.
- Using the whole base instead of its units digit for the cycle table, which is harmless but slow, or using the tens digit by mistake.
- Forgetting that a cycle of length 1 (bases ending in 0, 1, 5, 6) has no variation.
- Computing a sum of powers by combining the exponents rather than finding each units digit separately.
Exercise
What is the units digit of 13¹⁰¹ + 8⁵⁸?
Show answer
The units digit of 13¹⁰¹ is the same as that of 3¹⁰¹. The cycle for 3 is 3, 9, 7, 1, and 101 = 4 × 25 + 1, so the remainder is 1 and the digit is 3. For 8⁵⁸, the cycle is 8, 4, 2, 6, and 58 = 4 × 14 + 2, so the remainder is 2 and the digit is 4. The sum of the units digits is 3 + 4 = 7, so the units digit is 7.
Exercise
Quantity A is the units digit of 9⁷⁷. Quantity B is the units digit of 4⁵⁰. Which is greater, or are they equal?
Show answer
The cycle for 9 is 9, 1 (length 2). Since 77 is odd, the units digit is 9. The cycle for 4 is 4, 6 (length 2). Since 50 is even, the units digit is 6. Quantity A is 9 and Quantity B is 6, so Quantity A is greater.
Exercise
Find the units digit of 2^(3⁴) (that is, 2 raised to the power 81), and explain why you only need 81 mod 4.
Show answer
The units digits of powers of 2 cycle as 2, 4, 8, 6 with length 4, so only the exponent's remainder on division by 4 matters. 81 = 4 × 20 + 1, so the remainder is 1 and the units digit is the first in the cycle, 2.