# Calculate the last digit of $3^{347}$

I think i know how to solve it but is that the best way? Is there a better way (using number theory). What i do is: knowing that

1st power last digit: 3
2nd power last digit: 9
3rd power last digit: 7
4rh power last digit: 1
5th power last digit: 3

$3^{347} = 3^{5\cdot69+2} = (3^5)^{69} \cdot3^2 = 3\cdot3^2=3^3=27$ so the result is $7$.

• You got the answer for the wrong reasons.
– MT_
Apr 17, 2014 at 15:34
• $$(3^5)^{69} *3^2 =3^{69} *3^2$$ Apr 17, 2014 at 15:35
• Keep in mind that $3^{10}=59049$, but $10$ is divisible by $5$. $3^{10}$ does not end in a $3$ Apr 17, 2014 at 15:35

How about $$3^2 \equiv -1\pmod {10}$$ so $$3^{347} \equiv 3^{2\cdot 173+1} \equiv 3 \cdot(-1)^{173} \equiv -3 \equiv 7 \pmod {10}$$

I don't know why none of the current answers talk about why your methods are wrong and you just happened to get the right answer, so I guess I'll touch on that.

First off, it doesn't make any sense to "factor out" $3^5$ when the last digit cycles with a length of $4$. Regardless, it's not mathematically wrong, so here's how you would do it using that:

$3^{347} \equiv 3^{5*69 + 2} \equiv (3^5)^{69} * 3^2 \pmod {10}$

The next step is where you make your first mathematically incorrect error. You reduce $(3^5)^{69}$ to $3$, but actually it reduces to $3^{69}$. Then, you would say $3^{69} \equiv 3^{4 * 17 + 1} \equiv (3^4)^{17} * 3 \equiv (1)^{17} * 3 \equiv 3 \pmod {10}$. Luckily for you, this happens to reduce to $3$, so you got the right answer. Now we can safely conclude $(3^5)^{69} * 3^2 \equiv 3 * 3^2 \equiv 7 \pmod {10}$

As I said before, it makes much more sense to factor out $3^4$. Here's what it would look like using that method:

$3^{347} \equiv (3^4)^{86} *3^3 \equiv 1^{86}* 3^3 \equiv 7 \pmod {10}$

Much easier, yes?

• yes you are right! thanks so much Apr 17, 2014 at 15:47

The last digit rotates in a cycle of 4, not 5. You would be better off applying your method starting from 0:

0th power last digit: 1
1st power last digit: 3
2nd power last digit: 9
3rd power last digit: 7
4th power last digit: 1

And continue from there.

Your reasoning is wrong; you claimed $(3^5)^{69} \equiv 3$, but you were lucky that this was the case; it does not work in general. Since $3^5\equiv 3\pmod{10}$, you could have simplified $(3^5)^{69}$ to $3^{69}$ and proceeded from there.

It may be simpler to reduce by $3^4$, since $3^4\equiv 1\pmod{10}$: $$3^{347} = \big(3^4\big)^{86}\cdot3^3 \equiv 1^{86}\cdot3^3 = 3^3 = 27 \equiv 7\pmod{10}.$$

• His answer is correct, but his method is certainly not.
– MT_
Apr 17, 2014 at 15:36
• @MichaelT Thanks for pointing this out. I did not read the original answer carefully enough.
– MJD
Apr 17, 2014 at 15:37

Yes there are other ways. Clearly you need to work modulo 10 (you need to say so in your answer otherwise the equality doesn't make any sense.

Then notice that $3^2 = 9 \equiv -1 \mod 10$.
$347 = 173\times2 + 1$ ie you obtain : $$3^{347} \equiv (-1)^{173}\times 3 \equiv -3 \mod 10$$

Therefore last digit is $7$.

$$3^{4n+3}=(3^4)^n\cdot3^3=(1+80)^n\cdot(20+7)$$

Using Binomial Expansion, $$(1+80)^n=1+\binom n180+\cdots+\binom n{n-1}80^{n-1}++80^n\equiv1\pmod{10}$$

• This is clearly wrong. Apr 17, 2014 at 15:37
• @vonbrand It looks right to me. What don't you like about it? Was the passage from $(1+80)^n$ to $1^n$ too tricky?
– MJD
Apr 17, 2014 at 15:38
• The result is wrong. See the other answers. Also, bc(1) agrees with me that the last digit is 7. Apr 17, 2014 at 15:40
• Confusing, you don't give the end result. Half credit only. Apr 17, 2014 at 15:43
• @vonbrand, I think in MSE, the mean over end should get more priority. If one follows the method mentioned carefully, should be able to reach home safely. Apr 17, 2014 at 15:47

You need to be a bit more careful. You have $$3^4=81\equiv 1 \mod 10$$ You should use equivalences rather than equals when doing such a reduction, because it makes your workings clearer.

You have also noted $$3^5\equiv 3$$ And used this to reduce $(3^5)^{69}\times 3^2$ - what you should get is $$(3^5)^{69}\times 3^2 \equiv 3^{69}\times 3^2$$ and you need to reduce again.

If you were using a multiple of $4$ for reduction in the exponent rather than a multiple of $5$ you'd be taking a power of $1$ and that would simplify things..

The exponent $4$ works because there are $4$ integers less than $10$ and co-prime to $10$ - we say the Euler function $\varphi (10)=4$. You might what to investigate the Euler-Fermat theorem (an extension of Fermat's Little Theorem) which says that if $(n,r)=1$ (they are relatively prime) then $r^{\varphi(n)}\equiv 1 \mod n$.

You want: $$3^{347} \bmod 10$$ Luckily for you, $\gcd(3, 10) = 1$, so Euler's theorem helps out. $\phi(10) = (2 - 1) (5 - 1) = 4$, and: $$3^{347} \equiv 3^3 \equiv 7 \pmod{10}$$