# Find the last Digit of $237^{1002}$?

I looked at alot of examples online and alot of videos on how to find the last digit But the thing with their videos/examples was that the base wasn't a huge number. What I mean by that is you can actually do the calculations in your head. But let's say we are dealing with a $3$ digit base Number... then how would I find the last digit.

Q: $237^{1002}$

EDIT: UNIVERSITY LEVEL QUESTION.

It would be more appreciated if you can help answer in different ways.

Since the Last digit is 7 -->

• $7^1 = 7$
• $7^2 = 49 = 9$
• $7^3 = 343 = 3$
• $7^4 = 2401 = 1$

$.......$

$........$

• $7^9 = 40353607 = 7$

• $7^{10} = 282475249 = 9$

Notice the Pattern of the last digit. $7,9,3,1,7,9,3,1...$The last digit repeats in pattern that is 4 digits long.

• Remainder is 1 --> 7
• Remainder is 2 --> 9
• Remainder is 3 --> 3
• Remainder is 0 --> 1

So, $237/4 = 59$ with the remainder of $1$ which refers to $7$. So the last digit has to be $7$.

• What's your background? Are you in middle school? high school? college? Have you heard of modular arithmetic? Fermat's little theorem? Euler's theorem? This is important for us to know so that we can write an answer that makes sense to you. – Omnomnomnom Dec 20 '16 at 1:35
• The base can be as huge as you like as only the last digit will matter $237^{1002} = {23*10 + 7}^{1002} =$ a bunch of stuff times many powers of 10 $+ 7^{1002}$. As $7^4 = 49^2 = (50 - 1)^2=$ a bunch of stuff times powers of ten $+ 1$. The leas digit of $7^4$ is 1. So the last digit of $7^{4k} = (7^4)^k$ is also $1$. So the the last digit of $237^{1002}$ is the last digit of $7^{1000 + 2}$ is the last digit of $7^2$ is $9$. – fleablood Dec 20 '16 at 1:37
• I think that you should have searched the site before asking this question. For all practical purposes this is a duplicate of this mother thread, and also more closely contained in this thread and many others. – Jyrki Lahtonen Dec 20 '16 at 7:41
• Other similar questions: What will be the units digit of $7777^{8888}$? or Find the last digit of $77777^{77777}$. – Martin Sleziak Dec 20 '16 at 8:03
• @JyrkiLahtonen The last link you gave was a horrible one to use as a model. – Bill Dubuque Dec 20 '16 at 14:17

$$237^{1002} = (23*10 + 7)^{1002} = \sum_{i=0}^{1001}23^{1002-i}10^{1002-i}\;7^i{1002 \choose i} + 7^{1002} =\\ [\textit{some huge honking multiple of }10] + 7^{1002} = \\ [\textit{some huge honking multiple of } 10] + 49^{501} = \\ [\textit{some huge honking multiple of }10] + (50 - 1)^{501} =\\ [\textit{some huge honking multiple of }10] + [\textit{some other gorfurshlugging multiple of }10] + (-1)^{501} =\\ [\textit{some huge honking multiple of }10] + [\textit{some other gorfurshlugging multiple of }10] - 1 = \\ [\textit{some huge honking multiple of }10] + [\textit{one less than some other gorfurshlugging multiple of }10] + 9$$

So the last digit is $9$. Thing is only the last digits matter, and the last digits will cycle between $1, 7, 9, 3, 1, 7, 9, 3$. So you just need the last digit and the remainder of $1002$ divided by $4$.

=====

Crash course in modular arithmetic:

If you have some integer $N$ and we have two integers $a$ and $b$ so that $a = b \pm kN$ for some integer $k$ we say $a \equiv b \mod N$. We are basically considering an arithmetic system where we consider numbers by how much more than a multiple of $N$ they are.

Ex: If $4732895738927 \equiv 8647 \mod 10$ because $4732895738927 = 8647 + 10k$. Basically if $a \equiv b \mod 10$ then $a$ and $b$ have same last digit as $a = b + 10k$ for some $k$.

Lemma: if $a \equiv b \mod N$ and $c \equiv d \mod N$ then:

i) $a + c \equiv b+d \mod N$

ii) $ac \equiv bd \mod N$

iii) $a^n \equiv b^n \mod N$.

Pf: i) $a = b + kN$, $c = d + jN$ so $a+c = b + d + (j+k)N$ so $a+c \equiv b+d \mod N$.

ii) $a = b + kN$, $c = d + jN$ so $ac = (b+kN)(d+jN) = bd + (dk + bj)N + jkN^2 = bd + (dk + bj + jkN)N$. so $ac \equiv bd \mod N$.

iii) by induction $a^1 \equiv b^1 \mod N$ and if $a^n \equiv b^n \mod N$ then $a^{n+1} = a^na \equiv b^nb \mod N \equiv b^{n+1} \mod N$.

So we can apply this to your problem: $237 \equiv 7 \mod 10$ so $237^{1002} \equiv 7^{1002}$.

Notice: If you consider $0, 1,.....,N -1, N, 1 + N, ......, 2N-1, 2N, 2N + 1....$ there are at most $0,1,.....,N-1$ distinct values that can be equivalent $\mod N$ so for all the $a^k$ there must only a finite number of distinct things for $a^k$ to be equivalent $\mod N$ so there must be some $a^k \equiv a^j \mod N$ where $k \ne j$.

And if $a^k \equiv 1 \mod N$ then $a^{nk} = (a^k)^n \equiv 1^n \mod N \equiv 1 \mod N$.

So for example $7^2 \equiv 49 \equiv 9 \mod 10$

$7^3 = 7^2*7 \equiv \mod 10 \equiv 9*7 \equiv 63 \equiv 3 \mod 10$

$7^4 = 7^3*7 \equiv 3*7 \equiv 21 \equiv 1 \mod 10$.

So $7^{1000} = (7^4)^{250} \equiv 1^250 \equiv 1 \mod 10$.

Putting this all together:

$237^{1002} \equiv 7^{1002} = 7^{1000}*7^2 \equiv (7^4)^{250}*49 \equiv 1^{250}*49 \equiv 1*49 \equiv 9 \mod 10$

So $237^{1002}$ and $9$ have the same last digit; $9$.

====

A theorem that is beyond this crash course is Euler's Thereom. If $N$ and $a$ have not common factors, and if $\phi(N) =$ the number of numbers $1,2, ....,N$ that have no common factors with $n$... then $a^{\phi(N)} \equiv 1 \mod N$.

So in your problem $\phi(10) = 4$ because $1,3,7, 9$ have no factors in common with $10$ while $2,4,5,6,8,10$ do. And $7$ and $10$ have no common factors... So $7^4 \equiv 1 \mod 10$. (And we can test that and $7^4 = 49*49 = 40^2 + 2*9*40 + 9^2 \equiv 81 \equiv 1 \mod 10$.)

So $237^{1002} \equiv 7^{1002} \equiv (7^4)^{250}7^2 \equiv 1^{250}49 \equiv 9 \mod 10$.

• And the award to most mathematical use of "gorfurshlugging" goes to... – Omnomnomnom Dec 20 '16 at 1:55
• i edited ..can u check if its right or rong – user372204 Dec 20 '16 at 1:56

You want to know the last digit of $237^{1002}$, which is the same as the remainder of $237^{1002}$ after division by $10$. This calls for modular arithmetic. From $237\equiv7\pmod{10}$ it follows that $$237^{1002}\equiv7^{1002}\pmod{10}.$$ Now the base number is small; can you take it from here?

• Ok so Now..I would just do 7^1..7^2 .... 7^10 and recognize the pattern. Once that happens..i divide the 237 by the pattern number... then look at the remainder and get the answer. Rite??? – user372204 Dec 20 '16 at 1:43
• I'm not sure I understand what you mean, but it sounds wrong. If you like you can post a more detailed solution, then I can have a proper look. – Servaes Dec 20 '16 at 1:45
• 237 = 230 + 7. The 230 will all be multiples of 10 so they can be ignored. Only worry about the 7. The patter of 7 is 1, 49->9, 63->3, 21-1. It repeats every four. So the last digit of $237^{1002}$ is the same as the last digit of $7^{1002}$ is the same as the last digit of $7^2$ which is the same as the last digit of $49$ which is the same as $9$. – fleablood Dec 20 '16 at 1:49
• I edited...can someone check and tell me if its right – user372204 Dec 20 '16 at 1:52
• Anyone care to explain the downvote? – Servaes Dec 20 '16 at 17:59

${\rm mod}\ 10\!:\ \color{#c00}{7^{\large 4}\equiv\bf 1}\,\Rightarrow\, 7^{\large J+4K}\!\equiv 7^{\large J}(\color{#c00}{7^{\large 4}})^{\large K}\!\equiv 7^{\large J}\color{#c00}{\bf 1}^{\large K}\!\equiv 7^{\large J}\,$ by standard Congruence Rules.

Finally write $\ 1002 = J\!+\!4K\$ for $\,0\le J < 4\$ and apply the above.

Simple version without the notation:

$7 \times 1 = 7$

$7 \times 7 = 49$

$7 \times 9 = 63$

$7 \times 3 = 21$

Just look at the last digit in each case.

So the last digit of $7^1$ is $7$. The last digit of $7^2$ is $9$. The last digit of $7^3$ is $3$. And, the last digit of $7^4$ is $1$.

Thus the last digit of $7^5$ is also $7$. And the last digit of $7^9$ is $7$ (because $7^4 \times 7^4 \times 7 = 7^9$, and the last digits thereof are $1 \times 1 \times 7$.)

And the last digit of $7^{51}$ is the same as the last digit of $7^{47}$, which is the same as the last digit of $7^{43}$, which is the same as the last digit of $7^{39}$ (see the pattern?)...which is the same as the last digit of $7^{7}$, which is the same as the last digit of $7^3$, which is $3$.

By the same logic, the last digit of $7^{1002}$ is the same as the last digit of $7^2$, which is $9$.

There's a quite simple way of solving these kinds of problems using Chinese remainder theorem and Fermat's little theorem.

We want to know $237^{1002}$ mod $10$. As Servaes has pointed out, $237^{1002} \equiv 7^{1002} \mod{10}$, so we can work with $7^{1002}$ which is simpler.

Using Fermat's little theorem (which tells us $7^4 \equiv 1$ (mod $5$)) we get: $7^{1002} \equiv (7^4)^{250}\cdot7^2 \equiv 1^{250}\cdot49 \equiv 49 \equiv 4\ \ (\text{mod } 5)$

Also $7^{1002} \equiv 1^{1002} \equiv 1\ \ (\text{mod } 2)$,

The chinese remainder theorem tells us that the system \begin{cases} x \equiv 4 \ \ \text{(mod } 5) \\ x \equiv 1 \ \ \text{(mod } 2) \\ \end{cases}

Has exactly one solution mod $10$. It's easy to find it by trial and error since we only have 10 options: the solution is $x \equiv 9$ (mod $10$).

Treating $7^{1002}$ as our unknown and applying that result we conclude $7^{1002} \equiv 9$ (mod $10$).

Edit: a quicker but less mechanic way to solve this particular problem is to use Euler's theorem, which is a generalized version of Fermat's little theorem. Euler's theorem tells us that if $a$ and $n$ are relatively prime then $a^{\phi(n)} \equiv 1$ (mod $n$), where $\phi(n)$ counts the positive integers up to a given integer $n$ that are relatively prime to $n$.

With $n = 10$ and $a = 7$ we have $7^4 \equiv 1$ (mod 10). (Of course we don't need the theorem to know this, given that $7^4 = 2401$, but that's where we get the idea).

So $7^{1002} \equiv (7^4)^{250} \cdot 7^2 \equiv 1^{250}\cdot49\equiv49\equiv 9$ (mod 10).

Short version:

Modulo $10$, the powers of $237$ up to $1002$, like those of $7$, are $1,7,9,3,1,\cdots 9$. (The period is $4$).

• No thanks to the downvoter who probably missed that the answer is correct and complete. – Yves Daoust Dec 20 '16 at 15:24
• Looks like somebody entered here and down-voted several answers (or perhaps one user was down-voted, then down-voted all the others in retaliation). – barak manos Dec 20 '16 at 15:28
• @barakmanos: these guys must be missing a "downvote all" button ;-) – Yves Daoust Dec 20 '16 at 16:16
• Yes, this is a correct method that I used in junior middle school. No reason to be down-voted. – zongxiang yi Dec 20 '16 at 16:18
• It is quite irritating when no comment is provided, to be honest. Anyway, I have "compensated" you and the other user in this comment-thread, who was also down-voted despite the fact that his/her answer is correct. – barak manos Dec 20 '16 at 16:28

It will be many words to show the related theroy. So I would like the solve the problem as follow:

1. $237 \equiv 7 \pmod{10}$
2. $7 ^ 4 \equiv 1 \pmod{10}$
3. $1002 \equiv 2 \pmod{4}$

Now $237^{1002} \equiv 7^{1002} \equiv 7 ^ 2 \equiv 49 \equiv 9 \pmod{10}$.

So your answer is $9$. In a similar way, you can get the last two digits is $69$ as follow.

1. $237 \equiv 37 \pmod{100}$
2. $37 ^ {20} \equiv 1 \pmod{100}$
3. $1002 \equiv 2 \pmod{20}$

Now $237^{1002} \equiv 37^{1002} \equiv 37 ^ 2 \equiv 1369\equiv 69 \pmod{100}$.

• In your first example, how did you guess $4$? In your second example, how did you guess $20$? Did you actually check every $n\in[1,20]$ in order to reach this conclusion? Even so, how do you calculate $37^{20}$? This is not so easy (in opposed to $7^{4}$). – barak manos Dec 20 '16 at 8:50
• What I'm trying to imply is that instead of guessing $4$, you could have used $\phi(10)$, and instead of guessing $20$, you could have used $\phi(100)$, which would give you $40$ (instead of $20$) but ultimately lead you to the same result. – barak manos Dec 20 '16 at 8:51
• @barakmanos I see what you say. In fact I have said "It will be many words to show the related theroy", and everyone can obtain such complete theroy in any textbooks. I just left this to the questioner and hope he can explore such phenomenons. I think that will be better than showing him/she the truth directly. That's why I gave two examples: for the first one, $4=\varphi(10)$ but for the other one, $20 \ne \varphi(100)$. – zongxiang yi Dec 20 '16 at 15:41
• @barakmanos of course, it's worthy to recall that there should be an algorithm to compute $a^b\pmod{n}$ where $0<a,b<n$ and the case that $b<0$. That's another problems. Should I leave a link en.wikipedia.org/wiki/Modular_exponentiation or paste the content of that link? Since there already answers solve this problem in view of different aspects, I don't want to repeat something just in different languages. – zongxiang yi Dec 20 '16 at 16:13
• Your answer is correct. I just pointed out some issues, or more precisely, a better way for finding the exponent which yields $1\pmod{N}$. You can feel free to improve your answer regardless of other answers, just as long as it doesn't feel like a complete copy-paste from one of them. – barak manos Dec 20 '16 at 16:31

$237^{1002}=237^{1000+2}$

$237^2 \times 237^{1000}$

as you know unit digit in case of powers repeat after each fourth power

so $unit digit(237^2\times 237^{1000})=unit digit(237^2)\times unit digit(237^{1000})$

$=9\times 1=9$

$237\equiv-3\mod10$

$\therefore 237^{1002} \equiv(-3)^{1002} \equiv (-3)^2.(9)^{500}\equiv 9.(-1)^{500}\equiv 9 \mod10$

You can solve this using Euler's theorem:

• $\gcd(237,10)=1$
• Therefore $237^{\phi(10)}\equiv1\pmod{10}$
• Therefore $237^{\phi(2\cdot5)}\equiv1\pmod{10}$
• Therefore $237^{(2-1)\cdot(5-1)}\equiv1\pmod{10}$
• Therefore $237^{1\cdot4}\equiv1\pmod{10}$
• Therefore $237^{4}\equiv1\pmod{10}$

Therefore $237^{1002}\equiv237^{4\cdot250+2}\equiv(\color\red{237^{4}})^{250}\cdot237^{2}\equiv\color\red{1}^{250}\cdot237^{2}\equiv56169\equiv9\pmod{10}$.