# Last digit of a repeating period

In a collection of number theory problems, I found this one:

Give the last digit of the decimal period of $$\frac{133}{7^{88}}$$

After we start simplfying to $$\frac{19}{7^{87}}$$ I don't know what else to do. I do know that the period will be of $6\times7^{86}$ digits long, so it is infeasible to compute in the near(and very likely to be far) future with brute force. Midy's theorem does not help too much either. What to do next?

Hint: If $\gcd (p,10) = 1$, consider the fraction $\frac{1}{p} = 0. \overline{a_1 a_2\ldots a_n}$. What can you say about $p \times \overline{a_1 a_2\ldots a_n}$?

$p \times \overline{a_1 a_2\ldots a_n} = 10^n -1$

In particular, what is $p \times a_n \equiv \pmod{10}$?

$p \times a_n \equiv 9 \pmod{10}$

Now substitute $p = 7^{87}$. What is $a_n$? (You might find it useful to apply Euler's Theorem, which states that $7^4 \equiv 1 \pmod{10}$.

$7^{87} a_n \equiv 9 \Rightarrow a_n \equiv 3 \pmod{10}$

Now, what is the last digit in $\frac{19}{7^{87}}$?

It is the last digit of $19 \times 3 \equiv 7 \pmod{10}$.

Note: A similar procedure allows you to find the last $k$ digits.

• I get what you mean, but I cant see why this helps. – chubakueno Sep 19 '13 at 4:32
• @chubakueno What would take the place of ?? – Calvin Lin Sep 19 '13 at 4:33
• $9$, but how do I proceed then? – chubakueno Sep 19 '13 at 4:34
• @chubakueno I added the rest of the steps – Calvin Lin Sep 19 '13 at 4:36
• @chubakueno As a plug, I'd encourage you to check out Brilliant, if you want to learn math. – Calvin Lin Sep 19 '13 at 4:51