[Math] Repeating decimals linked to reciprocals of primes

decimal-expansionelementary-number-theory

Now this question is base dependent, I will assume base 10 but feel free to generalize.

I was noticing that for small primes that are not factors of the base ($2$ and $5$ terminate) the reciprocal of the prime (read $\frac 1p$) was a repeating decimal.

Will the reciprocal of any prime other than the two mentioned form a repeating decimal?

Is there anything you can say about the order of the repeating decimal if you know the prime that generated it?

Best Answer

In fact, if $p$ is a prime greater than $5$ (this excludes both primes $2$ and $5$ and also $3$), the decimal expansion of $1/p$ is periodic with period length equals $e=\operatorname{ord}_p(10)$ the order of $10$ modulo $p$, i.e., $e$ is the smallest positive integer such that $$10^e\equiv 1 \pmod p$$ This result can be generalizated in any number base $B>1$ and extended to any fraction $x/n$ where the numerator $x\in \mathbb{U}_n$, the set of positive integers less than and relatively primes to $n$ and $\gcd(B,n)=1$. With this hypothesis, the decimal expansion of $x/n$ in the base $B$ is periodic and its period length is the order of $B$ modulo $n$ (which exists because of the relatively prime condition between $B$ and $n$). Note that the period length of $x/n$ don't depend of $x$, so each one of the fraction $x/n$ always have the same period length.

Related Question