0

How do I go about finding the last digit of $7^{100}$ or the two last digits of $3^{885}$? what is the general method to solve problems like these?

quapka
  • 1,466
  • 9
  • 21
eyy321
  • 69
  • 2
    Hint: last digit of $7^4$ and $3^4$ is $1$. – Wojowu Nov 25 '15 at 20:48
  • 1
    See http://math.stackexchange.com/questions/290394/finding-the-last-two-digits, http://math.stackexchange.com/questions/86130/finding-the-last-two-digits-of-6543210, or any of several other questions under the "Related" heading on the right. The only difference is what numbers you start with, but the methods are the same. – David K Nov 25 '15 at 20:59

2 Answers2

4

Since $7$ and $10$ are coprime, Euler's theorem guarantees that $$ 7^{\varphi(10)}\equiv 7^{4}\equiv 1\text{ (mod }10) $$ where $\varphi$ is Euler's totient function. Thus $$ 7^{100}\equiv\left(7^4\right)^{25}\equiv 1^{25}\equiv 1\text{ (mod }10) $$ so the last digit of $7^{100}$ is $1$.

Note that $\varphi(100)=100(1-\frac{1}{2})(1-\frac{1}{5})=40$ using Euler's product formula, so since $3$ and $100$ are coprime, $$ 3^{\varphi(100)}\equiv3^{40}\equiv 1\text{ (mod }10) $$ and so $$ 3^{885}\equiv \left(3^{40}\right)^{22}\cdot 3^5\equiv 1^{22}\cdot 3^5\equiv 3^5\equiv 243\equiv 43\text{ (mod }100), $$ i.e. the last two digit of $3^{885}$ are $43$.

Edit: I misread the question as asking only about the last digit of $3^{885}$.

Michael M
  • 2,448
  • The second question wanted the last 2 digits, not just the last digit. – JB King Nov 25 '15 at 20:51
  • Oops, my mistake. I'll edit the answer. – Michael M Nov 25 '15 at 20:51
  • 1
    It's not trial and error. It's $\phi(n)$ = the number of positive integers less than n that are relatively prime to n. As 1, 3, 7 and 9 are relatively prime to 10, $\phi(10)$ = 4. Euler's theorem states that if a and m are relatively prime than $a^{\phi(m)} = 1 \mod m$. (This not intuitively obvious but is a well-known result). For 3 we have $3^{\phi(100)} = 1 \mod 100$. But what is $\phi(100)$? Well, Another not obvious but well known result is $\phi(n) = n \prod_{prime p|n}(1 - 1/p)$. So $\phi(100) = 100(1 - 1/2)(1-1/5) = 40$. So $3^{40} = 1 \mod 100$. – fleablood Nov 25 '15 at 21:38
  • nice, ty for the comment, how do you decide what can be a good n for ϕ(n) in problems like these? do I use n=100 for finding 2 digits and n=10 for finding the last digit or doesnt that stuff matter? @fleablood – eyy321 Nov 25 '15 at 22:01
  • 1
    It's obvious that the last $k$ digits of $n$ are congruent to $n$ (mod $10^k$). To see this, let $n=a_0+10\cdot a_1+\dots+10^n\cdot a_n$ and take both sides mod $10^k$: $n\equiv a_0+10\cdot a_1+\dots+10^{k-1}\cdot a_{k-1}+0+\dots+0$. – Michael M Nov 25 '15 at 22:03
  • 1
    The last k digits in base 10 mean the remainder when divided by 10^k. I sort of assumed that was obvious. The last digit of 2345714 is 4 because 2345714 = 23457110 + 4. The last 3 digits of 2345714 are 714 because 2345714 = 23451000 + 714 and so on. More to the point, if you wanted to find out the remainder of $12^{2345}$ when divided by $6125$ you could. – fleablood Nov 25 '15 at 22:21
  • how would I find the two last digits of 7^915 then? since I get (7^40)^22 7^35 = 17^35 (mod100) do I just find the two last digits of 7^35 then? if yes how do I do that? since ϕ(100)=40.... – eyy321 Nov 25 '15 at 22:44
  • 1
    There might be more efficient ways but $7^2 = 50 - 1$ so $7^4 = 2500 - 100 + 1 = 1 mod 100$ so $7^4 = 1 mod 100$. There was probably a way to predict that. Or maybe we are lucky. So $7^35 = 7^3 = 343 = 43 mod 100$. Note we aren't so lucky with the last 3 digits of $7^{915}$. As $7^4 = 2401 \ne 1 \mod 1000$. In this case $7^400 = 1 \mod 1000$ so $7^{915} = 7^{115}$. $7^4 = 2401 = 401 \mod 1000$ but here I make an educated guess... – fleablood Nov 25 '15 at 23:31
  • 1
    ...$7^4 = 401 \mod 1000$ so $7^{112} = 401^{28} \mod 1000 = (400)^28 + .....+ {28 \choose 2}400^2 + 28*400 + 1 \mod 1000 = 11201 = 201 \mod 1000$.

    So $7^{915} = 201*7^3 = 68943 = 943 \mod 1000$ so the last 3 digits of $7^{915}$ are 943.

    – fleablood Nov 25 '15 at 23:38
3

Since $\phi (100) = 40$ we have $3^{40} \equiv 1 \pmod {100}$ so $3^{885} = (3^{40})^{22} \cdot 3^5 \equiv 43 \pmod {100}$. Hence, the last two digits of $3^{885}$ is $43$.