# [Math] Recurring decimal expansion of $\frac17$

decimal-expansion

The decimal expansion of $\frac17$ seems to have an interesting pattern:
$$\frac{1}{7} = 0.142857142857142857…$$

Take the first two digits of the expansion: $14 = 2^1*7$

Then the next two: $28 = 2^2*7$

The pattern seems to halt abruptly with the next two: $57 \neq 2^2*7$ (since $2^3*7 = 56$)

But when continued further, the pattern established itself once more, although in a slightly different way:
$2^4*7 = 112$; the $1$ in the hundreds place appears to have been "carried over".

This leads us to:
$$\frac 17 = 0.14 + 0.0028 + 0.000056 + 0.00000112 …..$$

Or more concisely,
$$\frac 17 = (\frac{2^1*7}{10^2}) + (\frac{2^2*7}{10^4}) + (\frac{2^3*7}{10^6}) + (\frac{2^4*7}{10^8})….$$

The k-th term of the above geometric progression appears to be $7*(\frac{2}{100})^k.$

This infinite geometric progression $7*\sum_{k=1}^\infty (\frac{2}{100})^k$ evaluates to $\frac17$, which confirms the observation.

Since this expansion was obtained through observation and not through a rigorous proof, it offers no insight as to why such a pattern exists. Any insights regarding this pattern will be appreciated.

Edit: (rephrasing the question to make it more clear)
This infinite progression for $\frac17$ stems from a rather unusual pattern involving powers of $2$, and not from the recurring portion of the decimal ($0.142857$). The idea that the fraction $\frac17$ has anything to do with powers of two seems absurd, and I wanted to know if there is a justification for this pattern. Also, is this expansion involving powers of two unique to the fraction $\frac17$, or is there a more general way to apply this to any recurring decimal?

If I understood correctly, your question is about why certain groups of digits in the decimal expansion of $1/7$ are multiples of $7$, and why they also have a factor of $2^n$.

For a short version: jump to the end of my answer, the following is an explanation which is not as clean as the last paragraph.

You achieved to express $1/7$ as a geometric series

$$7\cdot\sum_{n=1}^{\infty} \left(\frac2{100}\right)^n.$$

The $100$ is not very surprising, as we are talking about digits in the decimal system. So powers of $10$ are always present. What might be puzzling is where the $2$ comes from. The limit of the series is

$$7\cdot\frac{2/100}{1-2/100}=7\cdot\frac2{100-2}=7\cdot\frac2{98}$$

and the reason this perfectly works out to $1/7$ is because $98=\color{red}{2}\cdot7\cdot 7$. The reason why this works so perfectly for $7$ (and not for other numbers $-$ then it would not really be surprising), is that $7^2+1=50$ is exactly $10^{2}/{\color{red}{2}}$ (and this is where $2$ comes into the game).

Let me explain. If we want that groups of digits of $1/p$ such that they are multiples of $p$ itself, we have to express it as a geometric series

$$\sum_{n=1}^{\infty}\left[p\cdot\left(\frac{q}{10^k}\right)^n\right].$$

The $10^k$ is an artifact of the decimal system and makes that our digits are (to some extent) exactly of the form $p\cdot q^n$ (e.g. $7\cdot2^n$ in your case). There are some ways to tweak this system, but let's stick to it for now. Evaluating this series gives

$$p\cdot\frac{q/10^k}{1-q/10^k}=p\cdot\frac{q}{10^k-q}.$$

For this to perfectly be $1/p$, we need $10^k-q=q\cdot p^2$ (check it, everything cancels out). We rearrange this to

$$q=\frac{10^k}{p^2+1}.$$

Here you see why this works for $p=7$. Then it turns out we can choose $k=2$ to get $q=2$. Until now I found no other number for which we have $p^2+1$ in such a nice form. If you allow that the digit groups are of the form $\alpha p\cdot q^n$ with some additional factor $\alpha$, then we are looking for combinations in which $\alpha p^2+1$ divides $10^k$. It is still not easy to find such combinations, but I found one or two nicer ones.

Using my method, I found that

$$\frac1{127}\approx 0.\color{lightgray}{00}\color{red}{7874}\color{lightgray}{0}15748\color{lightgray}{0}\color{red}{31496}\color{lightgray}{0}62992\color{red}{125984}251\, ...$$

which turned out to be generated by

\begin{align} \color{lightgray}{00}\color{red}{7874} &= 127 \cdot 31 \cdot 2^1 \\ \color{lightgray}{0}15748 &= 127 \cdot 31 \cdot 2^2 \\ \color{lightgray}{0}\color{red}{31496} &= 127 \cdot 31 \cdot 2^3 \\ \color{lightgray}{0}62992 &= 127 \cdot 31 \cdot 2^4 \\ \color{red}{125984} &= 127 \cdot 31 \cdot 2^5 \\ \cdots \end{align}

This example uses $q=2$, $k=6$, $p=127$ and $\alpha=31$. The reason for this nice pattern (and the occurence of $\color{red}2^n$) is again that $127^2\cdot31+1=500000=10^6/\color{red}2$.

When you are less restrictive on this kind of occuring pattern, e.g. $p$ needs no longer to be part of the digit sequence of $1/p$, then we can build an even nicer example from the one above:

$$\frac1{127^2}\approx 0.\color{lightgray}{0000}62\color{lightgray}{000}124\color{lightgray}{000}248\color{lightgray}{000}496\color{lightgray}{000}992\color{lightgray}{00}1984\color{lightgray}{00}3968\,...$$

where the black digits are just $31\cdot 2^n$.

Another crazy example is

$$\frac1{17}\approx 0.\color{lightgray}0\color{red}{58823529411764705882352941176470588235294}11764705\, ...$$

which follows the pattern $a(n)=17\cdot 1730103806228373702422145328719723183391\cdot 2^n$. For small values of $n$ we find

\begin{align} a(1)&=\color{lightgray}0\color{red}{58823529411764705882352941176470588235294}\\ a(2)&=117647058823529411764705882352941176470588\\ \cdots \end{align}

as expected. Unfortunately the numbers are so long that I cannot really show you how perfectly it fits. This pattern uses $p=17$, $q=2$, $k=42$ and an enormous $\alpha$ seen above. Once again we observe $17^2\cdot \alpha+1=10^{42}/\color{red}2$.

A more technical observation

Thinking about the problem so much brought me to an even more direct insight.

Let $q$ be a divisor of $10^k$ and $10^k/q-1=a\cdot b$. Then the digit pattern of the decimal representation of $1/a$ contains the sequence $b\cdot q^n$.

Proof.

$$\frac1a=b\cdot\frac1{ab}=b\cdot\frac1{10^k/q-1}=b\cdot\frac{q/10^k}{1-q/10^k}=\sum_{n=1}^{\infty} \left[b\cdot \left(\frac q{10^k}\right)^n\right].\qquad\square$$

This was used above and can be seen in all of the examples, e.g.

$$7\cdot7=\frac{10^2}2-1,\qquad 127^2\cdot 31=\frac{10^6}2-1$$

This shows a nice duality. Because of the symmetry between $a$ and $b$ we also see that $1/31$ contains the pattern $127^2\cdot 2^n$. No such duality can be observed in $1/7$ because this was the one case with $a=b=7$. We also see that the only possible values for $q$ are $2^s5^r$ because these are the only possible divisors of $10^k$.

This final observation allows us to generate an infinitude of examples with nice digit patterns. So I will simply stop here despite the problem really catching my attention. The examples presented above are not so nice in this new light but you can certainly find better ones now.