# If the last three digits of the repetend are $A67$, compute the digit $A$

When expanded as a decimal, the fraction 1/97 has a repetend (the repeating part of the decimal) that begins right after the decimal point and is 96 digits long. If the last three digits of the repetend are $A67$, compute the digit $A$.

This is a past ARML question I came across that I have no idea how to solve. Dividing it directly won't work and I don't know another way to solve this. Thanks in advance for posting a solution!

As it is the end of the reptend, when the $7$ is added to the quotient and multiplied by $97$ the remainder is $1$. We know this because we need to be back where we started from so we can start he reptend over. That means the remainder after the $6$ was $(7 \cdot 97 +1)/10=68$ to which we appended a $0$ and subtracted $679=7 \cdot 97$. Then before the $6$ was added we had $(6 \cdot 97 + 68)/10=65$ Now we need $97A+65$ to end in $0$, so $A=5$

Let $\frac{1}{97}=x$. Since the repetend is $96$ digits long, we see that $10^{96}x$ has the same decimal expansion as $x$. Now consider $10^{96}x-x=y$. We see that $y$ is an integer, and from the given information, $y$ ends in the digits $A67$. Let the leading digits be denoted by $D_1D_2D_3...D_n$. (They will mostly be irrelevant). So we have:

$$10^{96}x-x=D_1D_2...D_nA67$$

$$\frac{10^{96}-1}{97}=D_1D_2...D_nA67$$

$$10^{96}-1=(D_1D_2...D_nA67)\times 97$$

$$9...99999=(D_1D_2...D_n)\times 97000 + 9700A+6499$$

$$9...93500=(D_1D_2...D_n)\times 97000 + 9700A$$

$$9...935=(D_1D_2...D_n)\times 970 + 97A$$

We see that $A=5$ since the $(D_1D_2...D_n)\times 970$ ends in $0$ and the only way to end in $5$ is for $97A$ to end in $5$.