### A Theorem on Repeating Decimals

W. G. Leavitt
1967 The American mathematical monthly
I t is well known that a real number is rational if and only if its decimal expansion is a repeating decimal. For example, 2/7 =.285714285714 . . . . Many students also know that if n/m is a rational number reduced to lowest terms (that is, n and m relatively prime), then the number of repeated digits (we call this the length of period) depends only on m. Thus all fractions with denominator 7 have length of period 6. A sharp-eyed student may also notice that when the period (that is, the
more » ... that is, the repeating digits) for 2/7 is split into its two half-periods 285 and 714, then the sum 285+714=999 is a string of nines. A little experimentation makes it appear likely that this is always true for a fraction with the denominator 7, as well as for fractions with denominators 11, 13, or 17. A natural conjecture is that all primes with even length of period (note that many primes, such as 3 and 31, have odd length of period) will have a similar property. This conjecture is, in fact, true but it is unfortunately not a criterion for primeness, since many composite numbers (such as 77) also have the property. The relevant theorem appears not to be well known, although it was discovered many years ago. (L. E. Dickson [see 1, p. 1631 attributes the result to E. Midy, Nantes, 1836). The proof of the theorem is simple and elegant, and since it also provides a nice example of the usefulness of the concept of the order of an element of a group, it deserves to be better known. In the following, we will develop from the beginning the theory of repeating decimals. This is to provide the necessary machinery for the proof of Midy's theorem, as well as for completeness. Write (n, m) for the G.C.D. of n and m. Assuming n/m is a fraction reduced to lowest terms is thus equivalent to supposing (n, m) = 1. (Note: we are interested only in positive fractions, so we restrict ourselves to m > l and n>O.) Without loss of generality, we may also assume (10, m) = 1, for if m is divisible by 5 or 2 we could multiply numerator and denominator of n/m by the appropriate power of 2 or 5 to obtain n/m = 10-hnl/ml (for some integer h h I), where we still have (nl, m') = 1, and m1 is not divisible by either 2 or 5. Since dividing by 10h simply moves the decimal place, it is clear that the repeating digits of n/m are the same as those for nt/m'. Write n/m = c f hl/m where 0 < hl <m and c 1 0 is an integer. Since n = cmf h~, it is clear that we still have (hl, m) = 1. Also, since c may be any integer, the