# Prove that in any base the number of digits composing the repetitive mantissa of the reciprocal of a prime $p$ never exceeds $p-1$.

I was trying to find bases where the reciprocals of primes have a short repetitive mantissa. Here is what I found:

The bases are on the left. The primes are at the top. The numbers represent the quantity of digits composing the repetitive mantissa of the reciprocal of the prime at the top, expressed in the base on the left.

For example: In base 12 the prime 23 has a mantissa composed of 11 digits since $\dfrac{1}{23} = 0.06316948421...$ (repeating) in base 12.

Notice that I only picked bases which are either highly composite, powers of 2 or primorials (I also picked $36$ because it's $6^2$, $216$ because it's $6^3$ and $144$ because it's $12^2$).

So the result of my study is that base 120 seems to be extremely good at this. Base 6, base 30 and base 144 are also not bad.

But it seems that, in any base, the number of digits composing the repetitive mantissa of the reciprocal of a prime $p$ never exceeds $p-1$.

Can someone prove why this is true?

Also, it seems that the number of digits composing the repetitive mantissa of the reciprocal of a prime $p$ is always equal to $\dfrac{p-1}{n}$ where $n$ is a positive integer.

Could anyone explain why this occurs?

• This is closely related to the quantitative version of Artin's conjecture (which concerns the question "for a given base, how often does $1/p$ have period exactly $p-1$?"). It provides some rationale for the idea that some bases are better than others, although you seem to be focusing more on how small the periods below $p-1$ are. – Erick Wong Aug 20 '15 at 1:19

Fermat's theorem.

For any prime $p$ and $b$ not divisible by $p$, we have $b^{p-1} \equiv 1 \pmod{p}$. Let $k$ be the smallest positive integer such that $b^k \equiv 1 \pmod{p}$, and $p-1 = q\cdot k + r$ with $0 \leqslant r < k$. Then

$$b^{p-1} = b^{qk+r} = (b^k)^q \cdot b^r \equiv b^r \pmod{p},$$

so $b^r \equiv 1 \pmod{p}$, whence by definition of $k$ it follows that $r = 0$, in other words, $k$ is a divisor of $p-1$.

Now, $b^k \equiv 1 \pmod{p}$ means $b^k = 1 + p\cdot m$ for some $m$, or $m\cdot p = (b^k-1)$, which is

$$\frac{1}{p} = \frac{m}{b^k-1} = \frac{m}{b^k}\frac{1}{1-b^{-k}} = \sum_{\nu = 1}^\infty \frac{m}{b^{\nu\cdot k}},$$

and we have a period of length $k$ (prepending enough zeros to $m$ to have a number of $k$ digits) in base $b$.