Lesson Library> Last Digits

Last Digits

Last Digits
What Are Last Digits?

The last digit of a number is the digit at the very end, also called the unit digit. In this lesson, we will focus on how to find out the last digit of a calculation, without knowing what the whole answer is.


Exercise 1

What is the last digit in $749$?

The last digit is $\mathbf{9}$ because this is the rightmost digit in the number.


Determining the last digit of a sum using only last digits

Imagine that you are going to add two numbers. For example $744 + 418$. The most common way to do this by hand is to do long addition. You write the numbers on top of each other and then add the numbers digit by digit from the right to left. You probably notice that you know the last digit of the sum already when you have added $4$ with $8$ and gotten $12$. So you will have written that the sum ends in $2$ and carried the $1$ to the tens place. The important thing here is that we can know that $744 + 418$ ends in $2$, without doing the full calculation and knowing that the sum computes to $1162$. We can do this by looking at the sum of the last digits, $4 + 8 = 12$ and see that this ends in $2$.

Why is it like that? The example actually shows this quite clearly. When we added the last digits we got $12$, with $1$ carrying over to the next digit. We only have digits that carry from right to left, never from left to right. Therefore, only the last digits affect what the last digit in the answer will be.

Another way to illustrate this is to split off the last digit from the numbers we add. For example, $744 = 740 + 4$ and $418 = 410 + 8$. Then $744 + 418 = (740 + 4) + (410 + 8)$. Since $740$ and $410$ both end in $0$, they do not affect the last digit. So it is enough to look at the last digit of the sum $4 + 8$.

The same idea works for multiplication. If you want to multiply two large numbers $744 \cdot 418$, it is enough to look at the product of the last digits, $4 \cdot 8 = 32$, and see that the last digit becomes $2$. Feel free to think about what this would look like if you did the multiplication by hand with pen and paper.

To illustrate this, we can do in the same way as for addition. By dividing the numbers as $744 = 740 + 4$ and $418 = 410 + 8$. Now $744 \cdot 418$ becomes $(740 + 4) \cdot (410 + 8)$. This is the same as $740 \cdot 410 + 740 \cdot 8 + 4 \cdot 410 + 4 \cdot 8$. Here, all terms except $4 \cdot 8$ contain a factor ending in $0$, and will therefore not affect the last digit.

OBS! The corresponding does not work for division! For example, $\frac{12}{2} = 6$, but if we do the same calculation with the last digits, we get $\frac{2}{2} = 1$. This has to do with the fact that it doesn't make sense to split up $12$ as $10 ​​+ 2$ because $\frac{10}{2} = 5$ doesn't end in $0$. Examining only last digits generally doesn't work with division.


Exercise 2

What is the last digit in $572 + 395$?

The last digit in $572 + 395$ is the same as the last digit in $2 + 5 = 7$, which is $\mathbf{7}$. 


Exercise 3

What is the last digit in $1739 \cdot 8224$?

The last digit in $1739 \cdot 8224$ is the same as the last digit in $9 \cdot 4 = 36$, which is $\mathbf{6}$. 


Exercise 4

What is the last digit in $873 + 147 \cdot 593$?

Remember that multiplication comes before addition. We first calculate the last digit in $147 \cdot 593$ which we get from $7 \cdot 3 = 21$, so it is $1$. We now see that we are adding $873$ to a number that ends in $1$, so the sum must have the same last digit as $3+1 = 4$, so the last digit of the answer is $\mathbf{4}$. 


Determining the Last Digit of Powers

We will now go through how to calculate the last digit for powers such as $13^8$. If you do not know what powers are, you can briefly say that powers are repeated multiplication. $13^8 = 13 \cdot 13 \cdot 13 \dots 13$, in total a count of eight $13$ times each other.

A first simplification is that $13^8$ has the same last digit as $3^8$. We can understand this with the argument for last digits in multiplication that we learned earlier. If we multiply $13 \cdot 13 \cdot 13 \dots 13$, it will have the same last digit as if we multiply $3 \cdot 3 \cdot 3 \dots 3$.

After that, we can do the multiplication step by step and delete the numbers that are not last numbers because they will not affect the last number in the answer.


Example 1

What is the last digit in $13^8$?

Solution

$13^8$ has the same last digit as $3^8$. The last digit of $3^8$ we can calculate by adding one $3$ a at a time and disregarding digits that are not last digits:


$3^1 = 3$ which has the last digit $3$.

$3^2 = 3 \cdot 3 = 9$ which has last digit $9$.

$3^3 = 3 \cdot 3^2 = 27$ which has last digit $\mathbf {7}$.

$3^4 = 3 \cdot 3^3$ which has the same last digit as $3 \cdot \mathbf{7} = 21$ which has last digit $1$.

$3^5$ has the same last digit as $3 \cdot 1 = 3$.

$3^6$ has the same last digit as $3 \cdot 3 = 9$.

$3^7$ has the same last digit as $3 \cdot 9 = 27$.

$3^8$ has the same last digit as $3 \cdot 7 = 21$ which has the last digit $\mathbf{1}$

$13^8$ thus has the last digit $\mathbf{1}$.


Maybe you noticed that the last digits in the example are repeated. The last digits were $3, 9, 7, 1, 3, 9, 7, 1$. If we think about it it is only the previous last digit that determines what the next last digit will be, since we take that number times $3$. Then we could really as soon as we saw that $3 ^ 5$ had the last digit $3$, the same as $3 ^ 1$ understand that the last digit would be repeated as $3, 9, 7, 1$ over and over again. We can use this to calculate the last digit of even larger powers, such as $13 ^ {501}$. Since it is a repeating cycle, we only need to know where in the cycle $13 ^ {501}$ ends up. The digits are repeated in a cycle of length $4$ and we wonder what number $501$ is in that cycle. We can find out with a remainder from division. If we divide $501$ with $4$ we get $\frac {501} {4} = 125$ and remainder $1$. We can see this as going $125$ laps and then one more step. Then we end up with the first element in the cycle, $3$. Another way of looking at it is that the last digit for $13 ^ {501}$ is the same as $13 ^ 1$, just $125$ rounds earlier, which has last digit $3$.

The method for finding the last digit for large powers is thus to calculate what the initial last digits will be, until they start to repeat themselves. They will always eventually repeat because there are only $10$ different last digits possible and as soon as the same last digit has appeared twice, the digits will repeat as they did in between. When you know what digits are included in the cycle and how long it lasts before it repeats itself, the last step is to find out where in the cycle the power you are looking for ends up. We do this with the help of a remainder from division. For example if a cycle is $4$ digits long and the power is $247$ after removing the part before the cycle starts (if there is such a part) we just need to divide $247$ with $4$ and see that the remainder is $3$ to know that it is the third digit in the cycle.

Problems to Solve

Exercise 1

a) How do the last digits for $7 ^ 1, 7 ^ 2, 7 ^ 3, \dots$ ​​repeat themselves? 

b) Calculate the last digit in $7 ^ {313}$.

c) Calculate the last digit in $57^{103}$.

a) The last digits are repeated $7, 9, 3, 1, 7, 9, 3, 1, \ldots$


b) The length of the cycle for the last digits is $4$. $\frac{313} {4} = 78$ with remainder $1$. The last digit is thus $\mathbf{7}$.


c) Since only the last number matters, we can look at $7 ^ {103}$ instead. $\frac {103} {4} = 25$ with remainder $3$. The last digit thus becomes $\mathbf{3}$ because $3$ is the third digit in the cycle.


Exercise 2

On a bead band are $2017$ beads. The beads follow the same pattern. Which color will the bead in place $2017$ have? The start of the band looks like: Red - Blue - Green - White - Black - Yellow - Red - Blue - Green - White - Black - Yellow - Red - …

The beads are repeated in the cycle Red - Blue - Green - White - Black - Yellow which has length $6$. $\frac {2017} {6} = 336$ with remainder $1$, so in place $2017$ there is a red pearl.


Exercise 3

What is the last digit in the calculation $9378 \cdot 5669 + 862 ^ {672}$?

If you eliminate everything but the last digits, the equation becomes $8 \cdot 9 + 2 ^ {672}$. We can see that $8 \cdot 9 = 72$ has last digit $2$. The last digits of powers of $2$ are repeated as $2, 4, 8, 6, 2, 4, 8, 6, \ldots$ The period is thus $4$. Dividing we get that $\frac{672}{4} = 168$ with remainder $0$. Since remainder $1$ corresponds to the last digit $2$, remainder $0$ should correspond to the digit that comes before $2$ in the cycle, so $6$. We can also see that remainder $0$ can be replaced by remainder $4$, and $6$ is the fourth element in the cycle. $2 ^ {672}$ has last digit $6$ so the whole sum has last digit $2 + 6 = \mathbf {8}$.


Exercise 4

Determine the last digit in the sum $2020 ^ {2021} +$$ 2021 ^ {2022} +$$ 2022 ^ {2023}$.

$2020 ^ {2021}$ has last digit $0$. $2021 ^ {2022}$ has last digit $1$. For $2022 ^ {2023}$ we have to look at the last digits for powers of $2$, which we did in the previous exercise. $2023$ has remainder $3$ in division with $4$, so the last digit of $2022 ^ {2023}$ is $8$. The whole sum has the last digit $0 + 1 + 8 = \mathbf{9}$.


Exercise 5

Let the number $N$ be the product of all positive integers from $99$ to $1$ which does not end in $0$ or $5$, i.e $N = 99 \cdot 98 \cdot 97 \cdot 96 \cdot 94 \ldots 12 \cdot 11 \cdot 9 \cdot 8 \cdot 7 \cdot 6 \cdot 4 \cdot 3 \cdot 2 \cdot 1$. What is the last digit in $N$?

It is enough to look at the last numbers in the numbers we multiply. We have $10$ factors of each last digit except $0$ and $5$. It is thus equivalent to finding the last number in $1 ^ {10} \cdot 2 ^ {10} \cdot 3 ^ {10} \cdot 4 ^ {10} \cdot 6 ^ {10} \cdot 7 ^ {10} \cdot 8 ^ {10} \cdot 9 ^ {10}$. By prime factoring the composite numbers $4$, $6$, $8$ and $9$ we can rewrite this product as:

$1 ^ {10} \cdot 2 ^ {10} \cdot 3 ^ {10}$$ \cdot (2 ^ 2) ^ {10} \cdot (2 \cdot 3) ^ {10} \cdot 7 ^ {10}$$ \cdot (2 ^ 3) ^ {10} \cdot (3 ^ 2) ^ {10} $

Which can be rewritten as:

$ 2 ^ {10} \cdot 3 ^ {10} \cdot 2 ^ {20}$$ \cdot 2 ^ {10} \cdot 3$$ ^ {10} \cdot 7 ^ {10} \cdot 2 ^ {30}$$ \cdot 3 ^ {20} $

Which is the same as:

$ 2 ^ {10 + 20 + 10 + 30}$$ \cdot 3 ^ {10 + 10 + 20}$$ \cdot 7 ^ {10} $

$$ 2 ^ {70} \cdot 3 ^ {40} \cdot 7 ^ {10} $$

With the method used on previous exercises, this has the same last digit as $4 \cdot 1 \cdot 9 = 36$, so $\mathbf {6}$.

You might think this is a lot of work. Let's compare with computing the whole number. $N = 99 \cdot 98 \cdot 97 \cdot 96 \cdot 94 \ldots 12 \cdot 11 \cdot 9 \cdot 8 \cdot 7 \cdot 6 \cdot 4 \cdot 3 \cdot 2 \cdot 1$ can be calculated with a computer. 

The result is: 

$$402234160506493032707377206263$$5644006682631073129026$$

$$065791147313105354118998768752$$4553179375700208519702$$

$$5628490126455918821376$$