Suppose you have a rational number $0 < r < 1$, and you want to express it in some prime base $p$. Then assuming the denominator r has a periodic expansion in the base, we might ask how the base-p real expansion and the p-adic expansion are related.
Messing around with a few examples here has led me to the following conjecture:
Conjecture: given some rational $0 < r < 1$ that has a periodic expansion in some base $p$, the period is identical to that of the $p$-adic expansion of $-r$.
Examples:
- 12/13, base 2 real expansion: $0.\overline{111011000100}...$
- -12/13, 2-adic expansion: $...\overline{111011000100}$
- 12/17, base 3 real expansion: $0.\overline{2010011202122110}...$
- -12/17, 3-adic expansion: $...\overline{2010011202122110}$
and so on.
This all seems intuitive enough from experimenting around with p-adic solenoids back in the day, which can be thought of as having infinite expansions to the left and right of the radix point, but where all periodic sequences infinite in both directions are equal to zero (for example, in the 2-adic solenoid, $...11111.11111... = 0$.
However, I'm not quite sure how to prove this rigorously. Under what conditions does this hold, and how does one prove this formally? Can this be extended to rationals outside of the range mentioned?
This is simple to prove when you write down what these periodic expansions actually mean. Note that in $\mathbb{R}$, $$\sum_{n=1}^\infty p^{-kn}=\frac{p^{-k}}{1-p^{-k}}=\frac{1}{p^k-1}.$$ That sum is exactly the number whose base $p$ expansion is $0.\overline{00\dots01}$, where there are $k-1$ $0$s. So in general, a rational number $0<r<1$ which has a $k$-periodic base $p$ expansion is just a number of the form $r=\frac{m}{p^k-1}$ for $0<m<p^k-1$, and the repeating sequence is just the base $p$ form of the integer $m$.
On the other hand, in $\mathbb{Z}_p$, $$\sum_{n=0}^\infty p^{kn}=\frac{1}{1-p^k}=-\frac{1}{p^k-1}$$ and this sum is similarly the number $\overline{00\dots01}$. So a rational number with $k$-periodic $p$-adic expansion is just a number of the form $-\frac{m}{p^k-1}$ for $0<m<p^k-1$, where the repeating sequence is just the base $p$ form of $m$.
Combining these two observations gives exactly your conjecture.