A Curious Proerty of the Decimal Exansion of Recirocals of Primes Amitabha Triathi January 6, 205 Abstract For rime 2, 5, the decimal exansion of / is urely eriodic. For those rime for which the length of the eriod is even, if we break u the digits in the eriodic art into two equal arts and add, we get a number all of whose digits are 9. We rovide a self-contained and simle roof of this old result of E. Midy. eriod, order, unit A63, A05, A07 The decimal exansion of / when is rime has aroused much renewed curiosity following an article by Brian Ginsberg [2], then an undergraduate student at Yale University, in the College Mathematics Journal in 2004. Ginsberg extended a curious result of E. Midy [9] about the decimal exansion of / in 836 when is a rime distinct from 2 and 5. As often haens in such cases, this result was rediscovered several times, for instance in [6] and []. Midy s Theorem has recently been the subject of much discussion following the article by Ginsberg; for examle, see ([3], [7], [8]). Before we state and rove Midy s Theorem, let us look at some examles. Consider, for instance, the decimal exansions of / for = 7, 3 and 9: 7 = 0.42857 3 = 0.076923 9 = 0.0526357894736842 We observe that the decimal exansion in each case is urely eriodic, and the length of the eriod is even. While the first art is always true for rimes 2, 5, the second art does not always hold; for examle, 3 = 0.3 has eriod length. Midy s result is about rimes for which the decimal exansion of Aeared in Pi Mu Esilon Journal 3 No. 7 (202), 427 430. Indian Institute of Technology, Delhi
/ has even eriod length. In such cases, if we break u the reeating digits into two equal blocks and add we find that we get a number with only 9 s: 42 + 857 = 999; 076 + 923 = 999; 052 63 578 + 947 368 42 = 999 999 999. It is the urose of this short note to exlain this rather curious but not so well known result of Midy. However, before the main result, we give the following characterization of the decimal exansion of rational numbers which is well known (see [5]). The eriod length of the digits in the exansion of / is linked to the following definition. Definition. Let m N. If gcd(a, m) =, the least ositive integer h such that m (a h ) is called the order of a mod m and denoted by ord m a. The existence of ord m a is a consequence of Euler s Theorem, which states that m (a φ(m) ) where φ(m) = m ( ), m with the emty roduct taken as. This is simly Lagrange s Theorem alied to the multilicative grou of units in Z m, whose order is defined to be φ(m). We are now in a osition to exlain the nature of the decimal exansion of rational numbers. Lemma. Let a, n be ositive integers, with n > and gcd(a, n) =. Let n = 2 α 5 β m, with gcd(m, 0) =. Then the decimal exansion of a/n is recurring if and only if m >. Moreover, if m >, the length of the non-recurring art is max{α, β} while that of the recurring art is ord m 0. Proof. The decimal exansion of a/n terminates if and only if a/n is of the form A/0 k for some A, k, which is true if and only if n 0 k. The last statement holds recisely when m =, and this comletes the first art of the lemma. Assume n = 2 α 5 β m, with gcd(m, 0) = and m >. If we reduce each term of the infinite sequence {a0 i } i mod n, by Pigeonhole Princile, two terms must be equal. If we choose the first such air, say a0 s and a0 s+l, then since gcd(a, n) =. Hence 0 s 0 s+l (mod n) 0 l (mod m) since gcd(m, 0) =. Since the congruence imlies that a0 s+k a0 s+l+k (mod n) for each k 0, the length of the eriod equals l = ord m 0. From the first congruence we see that both 2 α and 5 β must divide 0 s since each is corime to 0 l. The smallest such s equals max{α, β}, and this reresents 2
the length of the non-recurring art. Before we look at the roof of Midy s Theorem, let us take another look at the examles we considered at the beginning in light of Lemma. The decimal exansion of / when gcd(, 0) = is urely eriodic, and the length of the eriod is the least ositive integer h such that (0 h ) = } 9. {{.. 9 } consisting of h digits. All we can say for sure is that ord 0 = h must divide φ() =, but it is not ossible to determine h more exlicitly. It is a famous conjecture of C. F. Gauss that there are infinitely many rimes for which the decimal exansion of / has eriod length. Theorem. (Midy) Suose is a rime, 2, 5, for which ord 0 = 2d for some d. Then where a k + a d+k = 9 for k d. = 0.a a 2... a d a d+ a d+2... a 2d, Proof. We know from Lemma that the decimal exansion of / has a urely recurring exansion, and the length of the eriod equals ord 0 = 2d. Let us denote by A k the k-digit number a a 2... a k for k. Since A k is the quotient of 0 k by, we can write 0 k = A k + r k, () with r k <. Since / is the sum of an infinite geometric series with first term A 2d /0 2d and common ratio /0 2d, we have 0 2d = A 2d +. (2) Now ord 0 = 2d imlies (0 d + )(0 d ), so that must divide one of 0 d, 0 d +. But (0 d ) is not ossible since ord 0 = 2d; so must have 0 d (mod ). Thus 0 d = A d + ( ). (3) If we denote by A k the (2d k)-digit number a k+a k+2... a 2d for k, then A 2d = A d 0 d + A d. From (2) and (3) we have ( 0 2d ) (0 d )(0 d ( ) ) A d +A d = A 2d (0 d )A d = = 0 d. Hence the theorem. We close this article by remarking that the result of Midy extends to the decimal exansion of a/ for < a <. Lemma imlies that the decimal exansion of a/ is urely eriodic, with eriod length ord 0. If ord 0 =, then the 3
decimal digits in the exansion of a/ are got by a cyclic shift of those of /. For examle, cyclic shifts of the decimal digits in the exansion of 7 = 0.42857 accounts for 3 7 = 0.42857, 2 7 = 0.28574, 6 7 = 0.85742, 4 7 = 0.57428, 5 7 = 0.74285. If ord 0 = l <, then l ( ) and cyclic shifts of the decimal digits in the exansion of / accounts for l of the fractions a/. The fractions a/ for a are artitioned into ( )/l classes, with the digits in each class obtained from one another by cyclic shifts of the decimal digits. For examle, cyclic shifts of the decimal digits of 3 = 0.076923 accounts for the fractions 0 3 = 0.769230, 9 2 3 = 0.692307, 3 = 0.923076, 3 3 = 0.230769, 4 3 = 0.307692. The remaining fractions, 7 3 = 0.53846, 5 3 = 0.38465, 3 = 0.84653, 6 3 = 0.46538, 8 3 = 0.65384, 2 result from cyclic shifts of 3 = 0.53846. In general, if we start with the decimal exansion of a/, the cyclic shifts results in the decimal exansion of 0a/, 0 2 a/,..., 0 l a/, where l is the eriodic length of the exansion of a/. Theorem easily extends to any a/, where < a <. Indeed, assume as in Theorem, that is a rime, 2, 5, for which ord 0 = 2d for some d. Then a = 0.b b 2... b d b d+ b d+2... b 2d, where b k + b d+k = 9 for k d. To see this, write B k for the k-digit number b b 2... b k for k. Thus with s k <. Hence a 0 k = B k + s k, (4) a 0 2d = B 2d + a, a 0 d = B d + ( a). (5) If we denote by B k the (2d k)-digit number b k+b k+2... b 2d for k, then B 2d = B d 0 d + B d. From (5) we have B d +B d = B 2d (0 d )B d = a( 0 2d ) (0 d )(a 0 d ( a) ) = 0 d. Hence the extension to any a/. References [] Dickson, L. E., History of the Theory of Numbers, Vol., Chelsea Publishing Comany, New York, 952. 4
[2] Ginsberg, B. D., Midy s (nearly) secret theorem an extension after 65 years, College Mathematics Journal, Vol. 35, 26-30, 2004. [3] Guta, A. and B. Sury, Decimal Exansion of / and Subgrou Sums, Integers, Vol. 5, Article A-9, -5, 2005. [4] Honsberger, R., Ingenuity in Mathematics, Random House/Singer, New Mathematical Library, 970. [5] Hardy, G. H. and Wright, E. M., An Introduction to the Theory of Numbers, Fifth Corrected Edition, Oxford University Press, 988. [6] Leavitt, W. G., A Theorem on Reeating Decimals, American Mathematical Monthly, Vol. 74, 669-673, 967. [7] Lewittes, J., Midy s Theorem for Periodic Decimals, Integers, Vol. 7, Article A-2, -, 2007. [8] Martin, H. W., Generalizations of Midy s Theorem on Reeating Decimals, Integers, Vol. 7, Article A-3, -7, 2007. [9] Midy, E., De Quelques Prorietes des Nombres et des Fractions Decimales Periodiques, Nantes, 836. [0] Rademacher, H. and Toelitz, O., The Enjoyment of Mathematics, Dover Publications, 990. [] Shrader-Frechette, M., Comlementary Rational Numbers, Mathematics Magazine, Vol. 5, 90-98, 978. About the author: I enjoy lecturing on mathematical toics that are not routine, in articular mathematical roblem solving. Outside of mathematics, I enjoy laying table tennis, working on crosswords and sudoku, listening to music, and when given an oortunity, to demonstrate my comutational abilities. Amitabha Triathi Deartment of Mathematics, Indian Institute of Technology, Hauz Khas, New Delhi 006. atriath@maths.iitd.ac.in 5