There are several notational conventions for representing repeating decimals. None of them are accepted universally.
In English, there are various ways to read repeating decimals aloud. For example, 1.234 may be read "one point two repeating three four", "one point two repeated three four", "one point two recurring three four", "one point two repetend three four" or "one point two into infinity three four". Likewise, 11.1886792452830 may be read "eleven point repeating one double eight six seven nine two four five two eight three zero", "eleven point repeated one double eight six seven nine two four five two eight three zero", "eleven point recurring one double eight six seven nine two four five two eight three zero" "eleven point repetend one double eight six seven nine two four five two eight three zero" or "eleven point into infinity one double eight six seven nine two four five two eight three zero".
In order to convert a rational number represented as a fraction into decimal form, one may use long division. For example, consider the rational number 5/74:
etc. Observe that at each step we have a remainder; the successive remainders displayed above are 56, 42, 50. When we arrive at 50 as the remainder, and bring down the "0", we find ourselves dividing 500 by 74, which is the same problem we began with. Therefore, the decimal repeats: 0.0675675675....
For any integer fraction A/B, the remainder at step k, for any positive integer k, is A × 10k (modulo B).
For any given divisor, only finitely many different remainders can occur. In the example above, the 74 possible remainders are 0, 1, 2, ..., 73. If at any point in the division the remainder is 0, the expansion terminates at that point. Then the length of the repetend, also called "period", is defined to be 0.
If 0 never occurs as a remainder, then the division process continues forever, and eventually, a remainder must occur that has occurred before. The next step in the division will yield the same new digit in the quotient, and the same new remainder, as the previous time the remainder was the same. Therefore, the following division will repeat the same results. The repeating sequence of digits is called "repetend" which has a certain length greater than 0, also called "period".5
In base 10, a fraction has a repeating decimal if and only if in lowest terms, its denominator has any prime factors besides 2 or 5, or in other words, cannot be expressed as 2m 5n, where m and n are non-negative integers.
Each repeating decimal number satisfies a linear equation with integer coefficients, and its unique solution is a rational number. In the example above, α = 5.8144144144... satisfies the equation
The process of how to find these integer coefficients is described below.
Given a repeating decimal x = a . b c ¯ {\displaystyle x=a.b{\overline {c}}} where a {\displaystyle a} , b {\displaystyle b} , and c {\displaystyle c} are groups of digits, let n = ⌈ log 10 b ⌉ {\displaystyle n=\lceil {\log _{10}b}\rceil } , the number of digits of b {\displaystyle b} . Multiplying by 10 n {\displaystyle 10^{n}} separates the repeating and terminating groups:
10 n x = a b . c ¯ . {\displaystyle 10^{n}x=ab.{\bar {c}}.}
If the decimals terminate ( c = 0 {\displaystyle c=0} ), the proof is complete.6 For c ≠ 0 {\displaystyle c\neq 0} with k ∈ N {\displaystyle k\in \mathbb {N} } digits, let x = y . c ¯ {\displaystyle x=y.{\bar {c}}} where y ∈ Z {\displaystyle y\in \mathbb {Z} } is a terminating group of digits. Then,
c = d 1 d 2 . . . d k {\displaystyle c=d_{1}d_{2}\,...d_{k}}
where d i {\displaystyle d_{i}} denotes the i-th digit, and
x = y + ∑ n = 1 ∞ c ( 10 k ) n = y + ( c ∑ n = 0 ∞ 1 ( 10 k ) n ) − c . {\displaystyle x=y+\sum _{n=1}^{\infty }{\frac {c}{{(10^{k})}^{n}}}=y+\left(c\sum _{n=0}^{\infty }{\frac {1}{{(10^{k})}^{n}}}\right)-c.}
Since ∑ n = 0 ∞ 1 ( 10 k ) n = 1 1 − 10 − k {\displaystyle \textstyle \sum _{n=0}^{\infty }{\frac {1}{{(10^{k})}^{n}}}={\frac {1}{1-10^{-k}}}} ,7
x = y − c + 10 k c 10 k − 1 . {\displaystyle x=y-c+{\frac {10^{k}c}{10^{k}-1}}.}
Since x {\displaystyle x} is the sum of an integer ( y − c {\displaystyle y-c} ) and a rational number ( 10 k c 10 k − 1 {\textstyle {\frac {10^{k}c}{10^{k}-1}}} ), x {\displaystyle x} is also rational.8
Thereby fraction is the unit fraction 1/n and ℓ10 is the length of the (decimal) repetend.
The lengths ℓ10(n) of the decimal repetends of 1/n, n = 1, 2, 3, ..., are:
For comparison, the lengths ℓ2(n) of the binary repetends of the fractions 1/n, n = 1, 2, 3, ..., are:
The decimal repetends of 1/n, n = 1, 2, 3, ..., are:
The decimal repetend lengths of 1/p, p = 2, 3, 5, ... (nth prime), are:
The least primes p for which 1/p has decimal repetend length n, n = 1, 2, 3, ..., are:
The least primes p for which k/p has n different cycles (1 ≤ k ≤ p−1), n = 1, 2, 3, ..., are:
Main article: Reciprocals of primes
A fraction in lowest terms with a prime denominator other than 2 or 5 (i.e. coprime to 10) always produces a repeating decimal. The length of the repetend (period of the repeating decimal segment) of 1/p is equal to the order of 10 modulo p. If 10 is a primitive root modulo p, then the repetend length is equal to p − 1; if not, then the repetend length is a factor of p − 1. This result can be deduced from Fermat's little theorem, which states that 10p−1 ≡ 1 (mod p).
The base-10 digital root of the repetend of the reciprocal of any prime number greater than 5 is 9.9
If the repetend length of 1/p for prime p is equal to p − 1 then the repetend, expressed as an integer, is called a cyclic number.
Main article: Cyclic number
Examples of fractions belonging to this group are:
The list can go on to include the fractions 1/109, 1/113, 1/131, 1/149, 1/167, 1/179, 1/181, 1/193, 1/223, 1/229, etc. (sequence A001913 in the OEIS).
Every proper multiple of a cyclic number (that is, a multiple having the same number of digits) is a rotation:
The reason for the cyclic behavior is apparent from an arithmetic exercise of long division of 1/7: the sequential remainders are the cyclic sequence {1, 3, 2, 6, 4, 5}. See also the article 142,857 for more properties of this cyclic number.
A fraction which is cyclic thus has a recurring decimal of even length that divides into two sequences in nines' complement form. For example 1/7 starts '142' and is followed by '857' while 6/7 (by rotation) starts '857' followed by its nines' complement '142'.
The rotation of the repetend of a cyclic number always happens in such a way that each successive repetend is a bigger number than the previous one. In the succession above, for instance, we see that 0.142857... < 0.285714... < 0.428571... < 0.571428... < 0.714285... < 0.857142.... This, for cyclic fractions with long repetends, allows us to easily predict what the result of multiplying the fraction by any natural number n will be, as long as the repetend is known.
A proper prime is a prime p which ends in the digit 1 in base 10 and whose reciprocal in base 10 has a repetend with length p − 1. In such primes, each digit 0, 1,..., 9 appears in the repeating sequence the same number of times as does each other digit (namely, p − 1/10 times). They are:10: 166
A prime is a proper prime if and only if it is a full reptend prime and congruent to 1 mod 10.
If a prime p is both full reptend prime and safe prime, then 1/p will produce a stream of p − 1 pseudo-random digits. Those primes are
Some reciprocals of primes that do not generate cyclic numbers are:
(sequence A006559 in the OEIS)
The reason is that 3 is a divisor of 9, 11 is a divisor of 99, 41 is a divisor of 99999, etc. To find the period of 1/p, we can check whether the prime p divides some number 999...999 in which the number of digits divides p − 1. Since the period is never greater than p − 1, we can obtain this by calculating 10p−1 − 1/p. For example, for 11 we get
and then by inspection find the repetend 09 and period of 2.
Those reciprocals of primes can be associated with several sequences of repeating decimals. For example, the multiples of 1/13 can be divided into two sets, with different repetends. The first set is:
where the repetend of each fraction is a cyclic re-arrangement of 076923. The second set is:
where the repetend of each fraction is a cyclic re-arrangement of 153846.
In general, the set of proper multiples of reciprocals of a prime p consists of n subsets, each with repetend length k, where nk = p − 1.
For an arbitrary integer n, the length L(n) of the decimal repetend of 1/n divides φ(n), where φ is the totient function. The length is equal to φ(n) if and only if 10 is a primitive root modulo n.11
In particular, it follows that L(p) = p − 1 if and only if p is a prime and 10 is a primitive root modulo p. Then, the decimal expansions of n/p for n = 1, 2, ..., p − 1, all have period p − 1 and differ only by a cyclic permutation. Such numbers p are called full repetend primes.
If p is a prime other than 2 or 5, the decimal representation of the fraction 1/p2 repeats:
The period (repetend length) L(49) must be a factor of λ(49) = 42, where λ(n) is known as the Carmichael function. This follows from Carmichael's theorem which states that if n is a positive integer then λ(n) is the smallest integer m such that
for every integer a that is coprime to n.
The period of 1/p2 is usually pTp, where Tp is the period of 1/p. There are three known primes for which this is not true, and for those the period of 1/p2 is the same as the period of 1/p because p2 divides 10p−1−1. These three primes are 3, 487, and 56598313 (sequence A045616 in the OEIS).12
Similarly, the period of 1/pk is usually pk–1Tp
If p and q are primes other than 2 or 5, the decimal representation of the fraction 1/pq repeats. An example is 1/119:
where LCM denotes the least common multiple.
The period T of 1/pq is a factor of λ(pq) and it happens to be 48 in this case:
The period T of 1/pq is LCM(Tp, Tq), where Tp is the period of 1/p and Tq is the period of 1/q.
If p, q, r, etc. are primes other than 2 or 5, and k, ℓ, m, etc. are positive integers, then
is a repeating decimal with a period of
where Tpk, Tqℓ, Trm,... are respectively the period of the repeating decimals 1/pk, 1/qℓ, 1/rm,... as defined above.
An integer that is not coprime to 10 but has a prime factor other than 2 or 5 has a reciprocal that is eventually periodic, but with a non-repeating sequence of digits that precede the repeating part. The reciprocal can be expressed as:
where a and b are not both zero.
This fraction can also be expressed as:
if a > b, or as
if b > a, or as
if a = b.
The decimal has:
For example 1/28 = 0.03571428:
Given a repeating decimal, it is possible to calculate the fraction that produces it. For example:
Another example:
The procedure below can be applied in particular if the repetend has n digits, all of which are 0 except the final one which is 1. For instance for n = 7:
So this particular repeating decimal corresponds to the fraction 1/10n − 1, where the denominator is the number written as n 9s. Knowing just that, a general repeating decimal can be expressed as a fraction without having to solve an equation. For example, one could reason:
or
It is possible to get a general formula expressing a repeating decimal with an n-digit period (repetend length), beginning right after the decimal point, as a fraction:
More explicitly, one gets the following cases:
If the repeating decimal is between 0 and 1, and the repeating block is n digits long, first occurring right after the decimal point, then the fraction (not necessarily reduced) will be the integer number represented by the n-digit block divided by the one represented by n 9s. For example,
If the repeating decimal is as above, except that there are k (extra) digits 0 between the decimal point and the repeating n-digit block, then one can simply add k digits 0 after the n digits 9 of the denominator (and, as before, the fraction may subsequently be simplified). For example,
Any repeating decimal not of the form described above can be written as a sum of a terminating decimal and a repeating decimal of one of the two above types (actually the first type suffices, but that could require the terminating decimal to be negative). For example,
An even faster method is to ignore the decimal point completely and go like this
It follows that any repeating decimal with period n, and k digits after the decimal point that do not belong to the repeating part, can be written as a (not necessarily reduced) fraction whose denominator is (10n − 1)10k.
Conversely the period of the repeating decimal of a fraction c/d will be (at most) the smallest number n such that 10n − 1 is divisible by d.
For example, the fraction 2/7 has d = 7, and the smallest k that makes 10k − 1 divisible by 7 is k = 6, because 999999 = 7 × 142857. The period of the fraction 2/7 is therefore 6.
The following picture suggests kind of compression of the above shortcut. Thereby I {\displaystyle \mathbf {I} } represents the digits of the integer part of the decimal number (to the left of the decimal point), A {\displaystyle \mathbf {A} } makes up the string of digits of the preperiod and # A {\displaystyle \#\mathbf {A} } its length, and P {\displaystyle \mathbf {P} } being the string of repeated digits (the period) with length # P {\displaystyle \#\mathbf {P} } which is nonzero.
In the generated fraction, the digit 9 {\displaystyle 9} will be repeated # P {\displaystyle \#\mathbf {P} } times, and the digit 0 {\displaystyle 0} will be repeated # A {\displaystyle \#\mathbf {A} } times.
Note that in the absence of an integer part in the decimal, I {\displaystyle \mathbf {I} } will be represented by zero, which being to the left of the other digits, will not affect the final result, and may be omitted in the calculation of the generating function.
Examples:
3.254444 … = 3.25 4 ¯ = { I = 3 A = 25 P = 4 # A = 2 # P = 1 } = 3254 − 325 900 = 2929 900 0.512512 … = 0. 512 ¯ = { I = 0 A = ∅ P = 512 # A = 0 # P = 3 } = 512 − 0 999 = 512 999 1.09191 … = 1.0 91 ¯ = { I = 1 A = 0 P = 91 # A = 1 # P = 2 } = 1091 − 10 990 = 1081 990 1.333 … = 1. 3 ¯ = { I = 1 A = ∅ P = 3 # A = 0 # P = 1 } = 13 − 1 9 = 12 9 = 4 3 0.3789789 … = 0.3 789 ¯ = { I = 0 A = 3 P = 789 # A = 1 # P = 3 } = 3789 − 3 9990 = 3786 9990 = 631 1665 {\displaystyle {\begin{array}{lllll}3.254444\ldots &=3.25{\overline {4}}&={\begin{Bmatrix}\mathbf {I} =3&\mathbf {A} =25&\mathbf {P} =4\\&\#\mathbf {A} =2&\#\mathbf {P} =1\end{Bmatrix}}&={\dfrac {3254-325}{900}}&={\dfrac {2929}{900}}\\\\0.512512\ldots &=0.{\overline {512}}&={\begin{Bmatrix}\mathbf {I} =0&\mathbf {A} =\emptyset &\mathbf {P} =512\\&\#\mathbf {A} =0&\#\mathbf {P} =3\end{Bmatrix}}&={\dfrac {512-0}{999}}&={\dfrac {512}{999}}\\\\1.09191\ldots &=1.0{\overline {91}}&={\begin{Bmatrix}\mathbf {I} =1&\mathbf {A} =0&\mathbf {P} =91\\&\#\mathbf {A} =1&\#\mathbf {P} =2\end{Bmatrix}}&={\dfrac {1091-10}{990}}&={\dfrac {1081}{990}}\\\\1.333\ldots &=1.{\overline {3}}&={\begin{Bmatrix}\mathbf {I} =1&\mathbf {A} =\emptyset &\mathbf {P} =3\\&\#\mathbf {A} =0&\#\mathbf {P} =1\end{Bmatrix}}&={\dfrac {13-1}{9}}&={\dfrac {12}{9}}&={\dfrac {4}{3}}\\\\0.3789789\ldots &=0.3{\overline {789}}&={\begin{Bmatrix}\mathbf {I} =0&\mathbf {A} =3&\mathbf {P} =789\\&\#\mathbf {A} =1&\#\mathbf {P} =3\end{Bmatrix}}&={\dfrac {3789-3}{9990}}&={\dfrac {3786}{9990}}&={\dfrac {631}{1665}}\end{array}}}
The symbol ∅ {\displaystyle \emptyset } in the examples above denotes the absence of digits of part A {\displaystyle \mathbf {A} } in the decimal, and therefore # A = 0 {\displaystyle \#\mathbf {A} =0} and a corresponding absence in the generated fraction.
A repeating decimal can also be expressed as an infinite series. That is, a repeating decimal can be regarded as the sum of an infinite number of rational numbers. To take the simplest example,
The above series is a geometric series with the first term as 1/10 and the common factor 1/10. Because the absolute value of the common factor is less than 1, we can say that the geometric series converges and find the exact value in the form of a fraction by using the following formula where a is the first term of the series and r is the common factor.
Similarly,
Main article: Transposable integer
The cyclic behavior of repeating decimals in multiplication also leads to the construction of integers which are cyclically permuted when multiplied by certain numbers. For example, 102564 × 4 = 410256. 102564 is the repetend of 4/39 and 410256 the repetend of 16/39.
Various properties of repetend lengths (periods) are given by Mitchell13 and Dickson.14
For some other properties of repetends, see also.15
Various features of repeating decimals extend to the representation of numbers in all other integer bases, not just base 10:
For example, in duodecimal, 1/2 = 0.6, 1/3 = 0.4, 1/4 = 0.3 and 1/6 = 0.2 all terminate; 1/5 = 0.2497 repeats with period length 4, in contrast with the equivalent decimal expansion of 0.2; 1/7 = 0.186A35 has period 6 in duodecimal, just as it does in decimal.
If b is an integer base and k is an integer, then
For example 1/7 in duodecimal: 1 7 = ( 1 10 1 + 5 10 2 + 21 10 3 + A 5 10 4 + 441 10 5 + 1985 10 6 + ⋯ ) base 12 {\displaystyle {\frac {1}{7}}=\left({\frac {1}{10^{\phantom {1}}}}+{\frac {5}{10^{2}}}+{\frac {21}{10^{3}}}+{\frac {A5}{10^{4}}}+{\frac {441}{10^{5}}}+{\frac {1985}{10^{6}}}+\cdots \right)_{\text{base 12}}}
which is 0.186A35base12. 10base12 is 12base10, 102base12 is 144base10, 21base12 is 25base10, A5base12 is 125base10.
For a rational 0 < p/q < 1 (and base b ∈ N>1) there is the following algorithm producing the repetend together with its length:
The first highlighted line calculates the digit z.
The subsequent line calculates the new remainder p′ of the division modulo the denominator q. As a consequence of the floor function floor we have
thus
and
Because all these remainders p are non-negative integers less than q, there can be only a finite number of them with the consequence that they must recur in the while loop. Such a recurrence is detected by the associative array occurs. The new digit z is formed in the yellow line, where p is the only non-constant. The length L of the repetend equals the number of the remainders (see also section Every rational number is either a terminating or repeating decimal).
Repeating decimals (also called decimal sequences) have found cryptographic and error-correction coding applications.16 In these applications repeating decimals to base 2 are generally used which gives rise to binary sequences. The maximum length binary sequence for 1/p (when 2 is a primitive root of p) is given by:17
Courant, R. and Robbins, H. What Is Mathematics?: An Elementary Approach to Ideas and Methods, 2nd ed. Oxford, England: Oxford University Press, 1996: p. 67. ↩
Beswick, Kim (2004), "Why Does 0.999... = 1?: A Perennial Question and Number Sense", Australian Mathematics Teacher, 60 (4): 7–9 ↩
"Lambert's Original Proof that $\pi$ is irrational". Mathematics Stack Exchange. Retrieved 2023-12-19. https://math.stackexchange.com/questions/895611/lamberts-original-proof-that-pi-is-irrational ↩
Conférence Intercantonale de l'Instruction Publique de la Suisse Romande et du Tessin (2011). Aide-mémoire. Mathématiques 9-10-11. LEP. pp. 20–21. ↩
For a base b and a divisor n, in terms of group theory this length divides ord n ( b ) := min { L ∈ N ∣ b L ≡ 1 mod n } {\displaystyle \operatorname {ord} _{n}(b):=\min\{L\in \mathbb {N} \,\mid \,b^{L}\equiv 1{\bmod {n}}\}} (with modular arithmetic ≡ 1 mod n) which divides the Carmichael function λ ( n ) := max { ord n ( b ) ∣ gcd ( b , n ) = 1 } {\displaystyle \lambda (n):=\max\{\operatorname {ord} _{n}(b)\,\mid \,\gcd(b,n)=1\}} which again divides Euler's totient function φ(n). /wiki/Carmichael_function#Order_of_elements_modulo_n ↩
Vuorinen, Aapeli. "Rational numbers have repeating decimal expansions". Aapeli Vuorinen. Retrieved 2023-12-23. https://www.aapelivuorinen.com/blog/2017/03/06/rational-numbers-repeating-decimal-expansions/ ↩
"The Sets of Repeating Decimals". www.sjsu.edu. Archived from the original on 23 December 2023. Retrieved 2023-12-23. https://web.archive.org/web/20231223234518/https://www.sjsu.edu/faculty/watkins/repeatingdecimals.htm ↩
RoRi (2016-03-01). "Prove that every repeating decimal represents a rational number". Stumbling Robot. Archived from the original on 23 December 2023. Retrieved 2023-12-23. https://web.archive.org/web/20231223234333/https://www.stumblingrobot.com/2016/02/29/prove-that-every-repeating-decimal-represents-a-rational-number/ ↩
Gray, Alexander J. (March 2000). "Digital roots and reciprocals of primes". Mathematical Gazette. 84 (499): 86. doi:10.2307/3621484. JSTOR 3621484. S2CID 125834304. For primes greater than 5, all the digital roots appear to have the same value, 9. We can confirm this if... /wiki/Mathematical_Gazette ↩
Dickson, L. E., History of the Theory of Numbers, Volume 1, Chelsea Publishing Co., 1952. ↩
William E. Heal. Some Properties of Repetends. Annals of Mathematics, Vol. 3, No. 4 (Aug., 1887), pp. 97–103 ↩
Albert H. Beiler, Recreations in the Theory of Numbers, p. 79 ↩
Mitchell, Douglas W., "A nonlinear random number generator with known, long cycle length", Cryptologia 17, January 1993, pp. 55–62. /wiki/Cryptologia ↩
Dickson, Leonard E., History of the Theory of Numbers, Vol. I, Chelsea Publ. Co., 1952 (orig. 1918), pp. 164–173. /wiki/L._E._Dickson ↩
Armstrong, N. J., and Armstrong, R. J., "Some properties of repetends", Mathematical Gazette 87, November 2003, pp. 437–443. ↩
Kak, Subhash, Chatterjee, A. "On decimal sequences". IEEE Transactions on Information Theory, vol. IT-27, pp. 647–652, September 1981. ↩
Kak, Subhash, "Encryption and error-correction using d-sequences". IEEE Transactios on Computers, vol. C-34, pp. 803–809, 1985. ↩