How can the decimal expansion of this rational number not be periodic?

I just noticed that dividing $1 \div 998$ gives me the apparently non-periodic

$$0.001002004008016032064\ldots ,$$

which is $$10^{-3} + 2\times 10^{-6} + 4\times10^{-9} + 8\times 10^{-12} + \cdots = \sum_{i=0}^\infty 2^i 10^{-3(i+1)}.$$

Since every rational number expands into a finite or periodic decimal expansion, does that become periodic somehow? If so, how?

• The exponent of 2 pattern is followed only in the first few sets of three. Here is Wolfram Alpha for the complete expansion with period $498$. – Arpan May 5 '15 at 5:01
• The fact that the period is long for this number is an artifact of our use of base 10. Any number which is periodic in base 997 or 998 will be in base 10 as well. – Archaick May 5 '15 at 5:09

It does repeat, but with a very long period: Factoring the denominator into primes gives $$998 = 2 \cdot \color{#3f3fff}{499};$$ since $2$ is a factor of $10$ and $10$ is a primitive root modulo $\color{#3f3fff}{499}$, the period of repetition is $\color{#3f3fff}{499} - 1 = 498$ digits long. Indeed, consulting WolframAlpha gives:

\color{#bf0000}{ \begin{align} \smash{\frac{1}{998}} = 0.&\overline{00100200400801603206412825651302605210420841683366733466}\\ &\overline{93386773547094188376753507014028056112224448897795591182}\\ &\overline{36472945891783567134268537074148296593186372745490981963}\\ &\overline{92785571142284569138276553106212424849699398797595190380}\\ &\overline{76152304609218436873747494989979959919839679358717434869}\\ &\overline{73947895791583166332665330661322645290581162324649298597}\\ &\overline{19438877755511022044088176352705410821643286573146292585}\\ &\overline{17034068136272545090180360721442885771543086172344689378}\\ &\overline{7575150300601202404809619238476953907815631262525050}. \end{align} }

(The is analogous to the repetition of the decimal digits of, e.g., $1 / 14$: We have $14 = 2 \cdot 7$ and that $10$ is a primitive root modulo $7$, so the period of the decimal expansion of $1 / 14$ is $7$.)

• In my mobile the display is a terrible mess. – Vim May 5 '15 at 5:21
• @Vim Thanks. In a desktop browser it's a mess too, albeit formatted a little more nicely. Does your mobile browser have problems with the align environment in other display equations, or just with this one? – Travis May 5 '15 at 5:28
• No I'm using app instead of a browser. The app seems to be not very compatible with TeX display, occasionally. – Vim May 5 '15 at 5:58
• Where does the $499-1$ expression come from? The pattern doesn't hold for all primes; for example, $1/22$ has period $2$. – user2357112 May 5 '15 at 8:33
• @user2357112 Yes, you're right. Cheers for pointing this out, and I've edited the post to clarify: For a prime, the period is the order of $10$ modulo $p$. By Fermat's Little Theorem this quantity always divides $p - 1$; if it is equal to $p - 1$, we call $10$ a primitive root (modulo $p$). In your example, we have $10 \neq 1 \bmod 11$ but $10^{\color{red}{2}} = 1 \bmod 11$, giving the period ${\color{red}{2}}$. – Travis May 5 '15 at 10:02

Emphasis on "apparently". The same thing happens with $1/7$: $$\begin{array}{crrrrrrrrrl} & 0 & . & 14 \\ + & & & & 28 & & & & & & =2\times 14 \\ + & & & & & 56 & & & & & = 4\times 14 \\ + & & & & & 1 & 12 & & & & =8\times 14 \\ + & & & & & & 2 & 24 & & & =16\times 14 \\ + & & & & & & & 4 & 48 & & = 32\times 14 \\ + & & & & & & & & & & \cdots \cdots \cdots \\ = & 0 & . & 14 & 28 & 57 & 14 & 28 & \cdots & & \cdots\cdots\cdots \end{array}$$

and $14\ 28\ 57$ keeps repeating, although the pattern identified above also continues.