<s>[INST] Is there a general pattern behind the decimal expansion of $\frac{1}{7}$ being $.14+.0028+.000056+.00000112+...=.\overline{142857}$? I wondered if all decimal expansions of $\frac{1}{n}$ could be thought of in such a way, but clearly for $n=6$,
$$.12+.0024+.000048+.00000096+.0000000192+...\neq.1\bar{6}$$
Why does it work for 7 but not 6? Is there only one such number per base, i.e. 7 in base 10? If so what is the general formula?
 [/INST] The expansion in your title formula is effectively $\displaystyle \sum_1^\infty 7 \times \left(\frac{2}{100}\right)^n = 7 \times \frac {1}{49} = \frac {1}{7}$
Simpler similar ones might be $\displaystyle \sum_1^\infty 2 \times \left(\frac{2}{10}\right)^n = 2 \times \frac {1}{4} = \frac {1}{2}$, i.e. $0.4 + 0.08 +0.016 + \cdots = 0.5$ or $\displaystyle \sum_1^\infty 3 \times \left(\frac{1}{10}\right)^n = 3 \times \frac {1}{9} = \frac {1}{3}$, i.e. $0.3 + 0.03 +0.003 + \cdots = 0.333\ldots$ or $\displaystyle \sum_1^\infty 1 \times \left(\frac{5}{10}\right)^n = 1 \times \frac {1}{1} = 1$, i.e $0.5 + 0.25 +0.125 + \cdots = 1$.
To get $\frac {1}{6}$, a possibility, though not so pretty, is  $\displaystyle \sum_1^\infty 4 \times \left(\frac{4}{100}\right)^n$ i.e. $0.16 + 0.0064 +  0.000256 + \cdots = 0.1666\ldots$.
One approach to getting $\frac {1}{k}$ is to look for a multiple of $k$ (say $mk$) which is one less than a number whose prime factors are $2$ or $5$.  Then $mk+1$ will divide some power of $10$ (say $10^h =g (mk+1)$).  You will then be able to write  $\displaystyle \sum_1^\infty m \times \left(\dfrac{g}{10^h}\right)^n = m \times \frac {1}{mk} = \frac {1}{k}$.  In your original example $k=7, m=7, g=2, h=2$, but apart from having $k=m$ as in my next three examples, there is nothing particularly special about it. 
</s>