Last Digits Of Large Numbers

Suppose we want to find the last digit of some large number. For relatively small numbers like 212, this is rather easy to compute. However for large numbers such as 1323422293, this is a rather difficult task.

# Last Digits as Remainders

Finding the last digit of a number if equivalent to finding the remainder of a number when divided by 10. This is for an integer n such that:

(1)
$$n = d_k 10^k + d_{k-1}10^{k-1} + ... + d_1 10^1 + d_0 10^0$$

then it follows that:

(2)
\begin{align} d_k 10^k + d_{k-1}10^{k-1} + ... + d_1 10^1 + d_0 10^0 \equiv d_0 \pmod {10} \end{align}

## Lemma 1: For all integers n = dk10k + dk-110k-1 + … + d1101 + d0100, the last digit, d0, can be represented as by n (mod 10).

• Proof: Let n be an integer represents in the fashion:
(3)
$$n = d_k 10^k + d_{k-1}10^{k-1} + ... + d_1 10^1 + d_0 10^0$$
• Thus it follows that:
(4)
\begin{align} n \equiv d_k 10^k + d_{k-1}10^{k-1} + ... + d_1 10^1 + d_0 10^0 \pmod {10} \end{align}
• 10 (mod 10) = 0, so it thus follows that:
(5)
\begin{align} n \equiv d_k (0)^k + d_{k-1}(0)^{k-1} + ... + d_1 (0)^1 + d_0 (0)^0 \pmod {10} \\ n \equiv d_0 \pmod {10} \end{align}
• Thus the proof is complete. When n is divided by 10, the remainder is equal to the last digit of that number.

### Example 1

Determine the last digit of 3347.

We will complete this by first finding a small number between 0, 1, 2, …, 8, 9 which is congruent 1 or -1 (mod 10). For example 9 ≡ -1 (mod 10) since 9 ≡ 9 (mod 10). It thus follows that 3^2 = 9, so then:

(6)
\begin{align} (3^2)^2 \equiv 81 \pmod {10} // (3^2)^2 = 3^4 \equiv 1 \pmod {10} \end{align}

We can now apply the division algorithm on 347 and 4 (our exponent) so that we obtain 347 = 4 * 86 + 3. Hence we can write that:

(7)
\begin{align} 3^{347} = 3^{4(86) +3} = (3^4)^{86}(3^3) \equiv (1)^{86}(3^3) \equiv 27 \pmod {10} \end{align}

So the last digit of 3347 is 7, since 27 (mod 10) is 7.