2

How would one go about finding the last 3 digits of a given number? For example, in my textbook, I'm asked to find the last $3$ digits of $2^{251}-1$ and also of $2^{756839}-1$. Can anyone tell me the procedure to do so? Perhaps we can make an example of the former, and then I can solve the latter?

Thank you guys!

John L.
  • 303

1 Answers1

1

You have to compute first the value of $2^{251}\bmod 1000$. Since $1000=8\times 125$, which are coprime, we can recover it from the value of $2^{251}\bmod 125$ with the Chinese Remainder theorem. Here are the tools, with some details:

We have an isomorphism: $$\mathbf Z/1000\mathbf Z\simeq \mathbf Z/8\mathbf Z\times \mathbf Z/125\mathbf Z,$$ and from a Bézout's relation $$47\cdot 8-3\cdot125=1,$$ we deduce the inverse isomorphism: $$(\alpha\bmod 8,\beta\bmod125)\longmapsto 47\cdot 8\beta-3\cdot125\alpha\bmod1000.$$ This yields us the value of $2^{251}\mod 1000$ as soon as we know its value $\bmod 8$ and $\bmod 125$. Naturally, its value $\bmod 8$ is $0$.

Now, as $\varphi(5^3)=5^2\cdot 4=100$ and $2$ and $125$ are coprime, we have $2^{100}\equiv 1\mod125$, and $2^{251}\equiv 2^{51}\mod 125$.

We can check $2^{50}\equiv-1\mod125$ by the Fast Exponentiation algorithm, hence $2^{51}\equiv -2\mod 125$. Or we can note $2^7=128\equiv 3\mod 125$, hence $$2^{51}\equiv 3^7\cdot 4\equiv3^5\cdot9\cdot4\equiv-7\cdot9\cdot4=-252 \equiv-2 \mod125.$$ Thus we obtain $$2^{251}\equiv -94\cdot 8=-752\equiv 248\mod1000,$$ and the last three digits of $2^{251}-1$ are $\;\color{red}{247}$.

Similar method for $2^{756839}-1$, which reduces to $2^{39}\mod 125$.

Bernard
  • 179,256
  • Thank you so much! I don't know anything about isomorphisms, but the idea that I need to calculate $2^{251} (mod 1000)$ makes perfect sense--and I should be able to do it from there. Thank's a million! – John L. Oct 27 '15 at 03:02
  • Isomorphisms are just a way to mean bijections compatible with addition and multiplication. It is here the abstract way to express the Chinese Remainder theorem. – Bernard Oct 27 '15 at 03:11
  • I thought I'd be able to figure this out, but I appear to be stuck. I don't know anything of isomorphisms, nor a lot of what you posted, but how might I go about calculating $2^{251}$ $mod 1000$ simply using the CRT? would I set x ≡ $2^{251}$ $mod 8$ and x ≡ $2^{251}$ $mod 125$ ? forgive my ignorance – John L. Oct 27 '15 at 03:15
  • You just have to use the formula for the inverse isomorphism – which is simply the formula to solve a pair of simultaneous congruences (when the moduli are coprime). Explicitly: $\alpha=2^{251}\bmod8$ and $\beta=2^{251}\bmod125$? Please let me know if this isn't clear enough. – Bernard Oct 27 '15 at 10:16
  • As I'm studying for a particular course, sadly that does not fall under what we have learned. So while it certainly is clear, I have no present use for it (sadly!).

    Thank you so much for all of your help, though! I'll just go see my prof and ask him to help me with it -- as I said, it's only in the textbook

    – John L. Oct 27 '15 at 20:34