3

Find the last five digits of the number $5^{1981}$

I know that the last three digits are $125$ because the last three digits tends to be $125$ or $625$. Since $1981$ is odd, the last three digits are $125$. But how do I find the last five digits?

Bill Dubuque
  • 272,048
user
  • 65
  • 10
  • I also know you can use modular 100000, and it probably has something to do with Euler's Totient function and Euler's theorem. – user Aug 16 '22 at 20:51
  • 3
    Note that, to solve for $N\pmod {10^n}$ it suffices to work $\pmod {2^n}$ and $\pmod {5^n}$ separately. Both of these are straightforward (one being considerably easier than the other). – lulu Aug 16 '22 at 20:58
  • I have tried that, however ϕ(100000) = 40000 which is greater than 1981. – user Aug 16 '22 at 20:58
  • 1
    lulu, so we just need to consider 5^1981 modulo 32, right? – user Aug 16 '22 at 20:59
  • In case it helps, $1981 = 7 \times 283$. – Dan Aug 16 '22 at 21:00
  • Yes, that is correct. You can just work $\pmod {2^5}$. – lulu Aug 16 '22 at 21:17
  • The same way you know that $5^k\equiv 5\pmod 10; 5^k\equiv 25\pmod {100};k\ge 2$ and $5^k\equiv 125\pmod{125};k\ even;5^k\equiv 625;k\ odd;k \ge 3$ figure out similar rules for $4$ and $5$ digits. just takes a little experimenting. – fleablood Aug 16 '22 at 21:52

2 Answers2

2

Per @lulu's comment, to find $5^{1981} \operatorname{mod} 10^5$, it suffices to find $5^{1981} \operatorname{mod} 2^5$ and $5^{1981} \operatorname{mod} 5^5$. The latter is obviously 0, so it suffices to work out the former.

Let's try repeated squaring.

  • $5^{1} \operatorname{mod} 32 = 5$
  • $5^{2} \operatorname{mod} 32 = 25$
  • $5^{4} \operatorname{mod} 32 = 25^2 \operatorname{mod} 32 = 17$
  • $5^{8} \operatorname{mod} 32 = 17^2 \operatorname{mod} 32 = 1$

And this is enough to work out $5^{1981} = (5^8)^{247} \times 5^4 \times 5 = 1 \times 17 \times 5 = 21$ (modulo 32).

So now we need a number that's simultaneously equal to 0 modulo $5^5 = 3125$ (i.e., is a multiple of 3125) and equal to 21 modulo 32. And we don't have to look far, because it turns out that 3125 itself meets that condition.

Therefore, the last 5 digits of $5^{1981}$ are 03125.

Dan
  • 14,978
  • Thanks. I used 5^1981 = 5^(1981 (mod ϕ(32)) = 5^17 = 21 (mod 32) to get the same result. – user Aug 16 '22 at 21:41
  • is there an easier way to calculate 5^8 other than multiplying everything out? – user Aug 16 '22 at 21:42
  • $\times 5 = \times 10 \div 2$ so multiplying it out isn't hard. $5^1= 5; 5^2=50\div 2=25; 5^3 = 250\div 2 = 125; 5^4 = 1250\div 2=625; 5^5=6250\div 2= 3125; 5^6=31250\div 2 = 15625; 5^7 = 156250\div 2 = 78125; 5^8 = 781250\div 2 = 390625$. – fleablood Aug 16 '22 at 22:06
2

Using Dan's solution above, it's also possible to calculate 5^1981 modulo 32 by using Euler's Totient function. 5^(1981 modulo ϕ(32)) = 5^13 = 5 * (5^3)^4 = 5 * (-3)^4 = 5 * 81 = 5 * 17 = 85 = 21 (mod 32)

The rest follows Dan's solution.

user
  • 65
  • 10