Application: Decimal expansions of rational numbers

Let $ a_1,a_2,...$ be a sequence of integers. We call the sequence eventually periodic if there is an $ i_0\in \mathbb{N}$ and a $ P\in \mathbb{N}$ such that $ a_{i+P}=a_i$, for all $ i>i_0$. The smallest $ P$ for which this holds if called the period of the sequence.

It is well-known that a real number is rational if and only if it is eventually periodic.

Lemma 1.8.6   A real number $ r\in \mathbb{R}$ has an eventually periodic decimal expansion if and only if it is a rational number, $ r\in \mathbb{Q}$.

proof: Let

$\displaystyle r=b_0b_1...b_r.a_0a_1...,\ \ \ \ \ \ a_i,b_j\in \{0,1,..,9\},
\ b_0\not= 0,
$

denote the decimal expansion of $ r\in \mathbb{R}$. We shall call each $ a_i$ or $ b_j$ a digit in the expansion. One direction is very easy. Using the geometric series expansion $ 1/(1-x)=1+x+x^2+...$ is is easy to see that if the expansion of $ r$ is eventually periodic then $ r\in \mathbb{Q}$. The converse is less trivial. It suffices to consider the case $ 0<r<1$, since adding or subtracting an integer won't affect whether or not the expansion is eventually periodic. Let $ r=a/b\in \mathbb{Q}$, where $ a,b$ are relatively prime integers. If $ gcd(b,10)\not= 1$ then $ b=2^r5^sb'$, where $ r\geq 0$, $ s\geq 0$, and $ gcd(b',10)=1$. Note that $ a/b$ is eventually periodic if and only if $ 10^ta/b$ is eventually periodic, where $ t=max(r,s)$. Therefore, after possibly replacing $ a/b$ by $ 10^ta/b$, we may assume without loss of generality that $ gcd(10,b)=1$. By Euler's theorem, if $ (10,b)=1$ we know that there is a $ k>0$ such that $ 10^k\equiv 1 \ ({\rm mod}\ b)$ (indeed, we may take $ k=\phi(b)$ and the smallest possible such $ k$ must divide $ \phi(b)$, where $ \phi $ is Euler's totient function). If $ bd=10^k-1$ then we may write

$\displaystyle {ad\over bd}={ad\over 10^k-1}
={ad\over 10^k}{1\over 1-10^{-k}}
={ad\over 10^k}(1+10^{-k}+10^{-2k}+...).
$

Since $ ad<bd<10^k$, the number of non-zero digits in the decimal expansion of $ {ad\over 10^k}$ is at most $ k$. Therefore $ r$ has a periodic decimal expansion. $ \Box$

First, to illustrate the ideas in a simpler setting, let us consider the special case of the expansion of the number $ r=1/p$, $ p$ prime not equal to $ 2$ or to $ 5$. By the above proof, we know that if $ k>0$ is any integer satisfying $ 10^k\equiv 1 \ ({\rm mod}\ p)$ then $ 1/p$ is periodic with period $ k$. However, this period may not be the smallest possible period (remember, a sequence of integers which repeats every $ k$ times will also repeat every $ 2k$ times, for instance). We are naturally lead to the following concept (one which also occurs later in the study of group theory as well).

The above proof implies that the following result holds.

Lemma 1.8.7   Let $ k>0$ be the order of $ 10$ modulo $ p$ (in other words, suppose $ p\vert 99...9$, $ k$ $ 9$'s in a row, and $ k$ is smallest possible). Then $ 1/p$ is periodic with period $ k$ and there is no smaller period.

Example 1.8.8 (1)   Fermat's little theorem gives $ 10^6\equiv 1 \ ({\rm mod}\ 7)$. The order of $ 10$ modulo $ 7$ is $ 6$, so $ 1/7=.142857142857142...$ is period $ 6$.

(2) Fermat's little theorem gives $ 10^{10}\equiv 1 \ ({\rm mod}\ 11)$. The order of $ 10$ modulo $ 11$ is $ 2$, so $ 1/11=.090909...$ is period $ 2$.

(3) Fermat's little theorem gives $ 10^{18}\equiv 1 \ ({\rm mod}\ 19)$. The order of $ 10$ modulo $ 19$ is $ 18$, so $ 1/19=.05263157894736842105263157894736842105...$ is period $ 18$.

(4) Fermat's little theorem gives $ 10^{36}\equiv 1 \ ({\rm mod}\ 37)$. The order of $ 10$ modulo $ 37$ is $ 3$, so $ 1/37=.02702702...$ is period $ 3$.

This raises the question: When is the period of $ 1/p$ as long as possible (i.e., $ p-1$)? We shall call such a prime a full period prime. A curiosity about full-period primes: if the prime is $ p$, the period is p-1, so look at the first $ (p-1)/2$ and last $ (p-1)/2$ digits in the expansion of $ 1/p$. Those two $ (p-1)/2$-digit numbers add up to $ 9999...9999$.

Example 1.8.9 (a)   $ 1/7$ is .142 857 142 857 ... and $ 142+857 = 999$.

(b) $ 1/23$ is 0.04347826086 95652173913 043... and
$ 04347826086+95652173913 = 99999999999$

We are naturally lead to the following concept (one which also occurs later under a different name in the study of cyclic groups).

Definition 1.8.10   Let $ p$ be a prime. We say that $ a$ is a primitive root modulo $ p$ if the smallest $ k>0$ satisfying $ a^k\equiv 1 \ ({\rm mod}\ p)$ is $ k=p-1$.

Thus the question ``When is the period of $ 1/p$ as long as possible?'' becomes ``For which primes $ p$ is $ 10$ a primitive root mod $ p$?" To our knowledge, there does not seem to be a simple answer to this question. Artin conjectured in the 1920s the following statement.

Conjecture 1.8.11 (Artin)   Every positive integer $ x>1$ is the primitive root of $ p$ for infinitely many primes $ p$.

So that means that $ 10$ should be the primitive root for infinitely many primes $ p$, so there should be infinitely many full-period primes. Quantitatively, the conjecture boils down to $ 37\%$ of all primes asymptotically have $ 10$ as primitive root (the $ 37\%$ is really an approximation to Artin's constant; it's $ \prod_{p\, {\rm prime}} (1-1/(p(p-1)))$). Although many people have tried, Artin's conjecture is not yet proven.



David Joyner 2007-09-03