Repeating decimal
A repeating decimal or recurring decimal is decimal representation of a number whose digits are periodic and the infinitely repeated portion is not zero. It can be shown that a number is rational if and only if its decimal representation is repeating or terminating. For example, the decimal representation of becomes periodic just after the decimal point, repeating the single digit "3" forever, i.e. 0.333.... A more complicated example is, whose decimal becomes periodic at the second digit following the decimal point and then repeats the sequence "144" forever, i.e. 5.8144144144.... At present, there is no single universally accepted [|notation or phrasing] for repeating decimals.
The infinitely repeated digit sequence is called the repetend or reptend. If the repetend is a zero, this decimal representation is called a terminating decimal rather than a repeating decimal, since the zeros can be omitted and the decimal terminates before these zeros. Every terminating decimal representation can be written as a decimal fraction, a fraction whose divisor is a power of 10 ; it may also be written as a ratio of the form . However, every number with a terminating decimal representation also trivially has a second, alternative representation as a repeating decimal whose repetend is the digit 9. This is obtained by decreasing the final non-zero digit by one and appending a repetend of 9. 0.999...| and are two examples of this.
Any number that cannot be expressed as a ratio of two integers is said to be irrational. Their decimal representation neither terminates nor infinitely repeats but extends forever without regular repetition. Examples of such irrational numbers are the square root of 2 and pi|.
Background
Notation
There are several notational conventions for representing repeating decimals. None of them are accepted universally.- In the United States, Canada, India, France, Germany, Switzerland, Czechia, and Slovakia the convention is to draw a horizontal line above the repetend.
- In the United Kingdom, New Zealand, Australia, South Korea, and mainland China, the convention is to place dots above the outermost numerals of the repetend.
- In parts of Europe and Vietnam, the convention is to enclose the repetend in parentheses. This can cause confusion with the notation for standard uncertainty.
- In Spain and some Latin American countries, the arc notation over the repetend is also used as an alternative to the vinculum and the dots notation.
- Informally, repeating decimals are often represented by an ellipsis, especially when the previous notational conventions are first taught in school. This notation introduces uncertainty as to which digits should be repeated and even whether repetition is occurring at all, since such ellipses are also employed for irrational numbers such as 3.14159....
Fraction | Vinculum | Dots | Parentheses | Arc | Ellipsis |
0. | 0. | 0.111... | |||
= | 0. | 0. | 0.333... | ||
= | 0. | 0. | 0.666... | ||
= | 0. | 0. | 0.8181... | ||
= | 0.58 | 0.58 | ... | ||
= | 0. | 0. | ... | ||
= | 0. | 0. | ... | ||
= | 3. | 3. | ... |
In English, there are various ways to read repeating decimals aloud. For example, 1.2 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".
Decimal expansion and recurrence sequence
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 :0.0
74 ) 5.00000
4.44
560
518
420
370
500
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:....
Every rational number is either a terminating or repeating decimal
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”.
Every repeating or terminating decimal is a rational number
Each repeating decimal number satisfies a linear equation with integer coefficients, and its unique solution is a rational number. To illustrate the latter point, the number above satisfies the equation, whose solution is. The process of how to find these integer coefficients is described [|below].Table of values
Thereby L is the length of the repetend.The repetend lengths of, n = 1, 2, 3,..., are:
The repetends of, n = 1, 2, 3,..., are:
The repetend lengths of, p = 2, 3, 5,..., are:
The least primes p for which has repetend length n, n = 1, 2, 3,..., are:
The least primes p for which has n different cycles, n = 1, 2, 3,..., are:
Fractions with prime denominators
A fraction in lowest terms with a prime denominator other than 2 or 5 always produces a repeating decimal. The length of the repetend of is equal to the order of 10 modulo p. If 10 is a primitive root modulo p, the repetend length is equal to p − 1; if not, the repetend length is a factor of p − 1. This result can be deduced from Fermat's little theorem, which states that.The base-10 repetend of the reciprocal of any prime number greater than 5 is divisible by 9.
If the repetend length of for prime p is equal to p − 1 then the repetend, expressed as an integer, is called a cyclic number.
Cyclic numbers
Examples of fractions belonging to this group are:- = 0., 6 repeating digits
- = 0., 16 repeating digits
- = 0., 18 repeating digits
- = 0., 22 repeating digits
- = 0., 28 repeating digits
- = 0., 46 repeating digits
- = 0., 58 repeating digits
- = 0., 60 repeating digits
- = 0., 96 repeating digits
Every proper multiple of a cyclic number is a rotation:
- = 1 × 0.142857... = 0.142857...
- = 2 × 0.142857... = 0.285714...
- = 3 × 0.142857... = 0.428571...
- = 4 × 0.142857... = 0.571428...
- = 5 × 0.142857... = 0.714285...
- = 6 × 0.142857... = 0.857142...
A fraction which is cyclic thus has a recurring decimal of even length that divides into two sequences in nines' complement form. For example starts '142' and is followed by '857' while starts '857' followed by its nines' complement '142'.
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. They are:
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 will produce a stream of p − 1 pseudo-random digits. Those primes are
Other reciprocals of primes
Some reciprocals of primes that do not generate cyclic numbers are:- = 0., which has a period of 1.
- = 0., which has a period of 2.
- = 0., which has a period of 6.
- = 0., which has a period of 15.
- = 0., which has a period of 3.
- = 0., which has a period of 5.
- = 0., which has a period of 21.
- = 0., which has a period of 13.
- = 0., which has a period of 33.
To find the period of, 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. 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 can be divided into two sets, with different repetends. The first set is:
- = 0.076923...
- = 0.769230...
- = 0.692307...
- = 0.923076...
- = 0.230769...
- = 0.307692...,
- = 0.153846...
- = 0.538461...
- = 0.384615...
- = 0.846153...
- = 0.461538...
- = 0.615384...,
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.
Totient rule
For an arbitrary integer n, the length λ of the repetend of divides φ, where φ is the totient function. The length is equal to φ if and only if 10 is a primitive root modulo n.In particular, it follows that if and only if p is a prime and 10 is a primitive root modulo p. Then, the decimal expansions of 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.
Reciprocals of composite integers coprime to 10
If p is a prime other than 2 or 5, the decimal representation of the fraction repeats:The period must be a factor of λ = 42, where λ is known as the Carmichael function. This follows from Carmichael's theorem which states that if n is a positive integer then λ is the smallest integer m such that
for every integer a that is coprime to n.
The period of is usually pTp, where Tp is the period of. There are three known primes for which this is not true, and for those the period of is the same as the period of because p2 divides 10p−1−1. These three primes are 3, 487, and 56598313.
Similarly, the period of is usually pk–1Tp
If p and q are primes other than 2 or 5, the decimal representation of the fraction repeats. An example is :
where LCM denotes the least common multiple.
The period T of is a factor of λ and it happens to be 48 in this case:
The period T of is LCM, where Tp is the period of and Tq is the period of.
If p, q, r, etc. are primes other than 2 or 5, and k, l, m, etc. are positive integers, then
is a repeating decimal with a period of
where Tpk, Tql, Trm,... are respectively the period of the repeating decimals,,,... as defined above.
Reciprocals of integers not co-prime to 10
An integer that is not co-prime 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:
- An initial transient of max digits after the decimal point. Some or all of the digits in the transient can be zeros.
- A subsequent repetend which is the same as that for the fraction.
- a = 2, b = 0, and the other factors
- there are 2 initial non-repeating digits, 03; and
- there are 6 repeating digits, 571428, the same amount as has.
Converting repeating decimals to fractions
Another example:
A shortcut
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, where the denominator is the number written as n digits 9. Knowing just that, a general repeating decimal can be expressed as a fraction without having to solve an equation. For example, one could reason:
It is possible to get a general formula expressing a repeating decimal with an n-digit period, 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 will be the integer number represented by the n-digit block divided by the one represented by n digits 9. For example,
- 0.444444... = since the repeating block is 4,
- 0.565656... = since the repeating block is 56,
- 0.012012... = since the repeating block is 012 ; this further reduces to.
- 0.999999... = = 1, since the repeating block is 9
- 0.000444... = since the repeating block is 4 and this block is preceded by 3 zeros,
- 0.005656... = since the repeating block is 56 and it is preceded by 2 zeros,
- 0.00012012... = = since the repeating block is 012 and it is preceded by 2 zeros.
- 1.23444... = 1.23 + 0.00444... = + = + =
- *or alternatively 1.23444... = 0.79 + 0.44444... = + = + =
- 0.3789789... = 0.3 + 0.0789789... = + = + = =
- *or alternatively 0.3789789... = −0.6 + 0.9789789... = − + 978/999 = − + = =
- 1.23444... = =
- 0.3789789... = =
Conversely the period of the repeating decimal of a fraction will be the smallest number n such that 10n − 1 is divisible by d.
For example, the fraction 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 is therefore 6.
Repeating decimals as infinite series
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 and the common factor. 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,
Multiplication and cyclic permutation
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 is the repetend of and 410256 the repetend of.Other properties of repetend lengths
Various properties of repetend lengths are given by Mitchell and Dickson.- The period of for integer k is always ≤ k − 1.
- If p is prime, the period of divides evenly into p − 1.
- If k is composite, the period of is strictly less than k − 1.
- The period of, for c coprime to k, equals the period of.
- If k = 2a5bn where n > 1 and n is not divisible by 2 or 5, then the length of the transient of is max, and the period equals r, where r is the smallest integer such that.
- If p, p′, p″,... are distinct primes, then the period of equals the lowest common multiple of the periods of,,,....
- If k and k′ have no common prime factors other than 2 or 5, then the period of equals the least common multiple of the periods of and.
- For prime p, if
- If p is a proper prime ending in a 1, that is, if the repetend of is a cyclic number of length p − 1 and p = 10h + 1 for some h, then each digit 0, 1,..., 9 appears in the repetend exactly h = times.
Extension to other bases
Various features of repeating decimals extend to the representation of numbers in all other integer bases, not just base 10:- Any real number can be represented as an integer part followed by a radix point followed by a finite or infinite number of digits.
- If the base is an integer, a terminating sequence obviously represents a rational number.
- A rational number has a terminating sequence if all the prime factors of the denominator of the fully reduced fractional form are also factors of the base. These numbers make up a dense set in and.
- If the positional numeral system is a standard one, that is it has base
- A rational number has an indefinitely repeating sequence of finite length, if the reduced fraction's denominator contains a prime factor that is not a factor of the base. If is the maximal factor of the reduced denominator which is coprime to the base, is the smallest exponent such that divides. It is the multiplicative order of the residue class which is a divisor of the Carmichael function which in turn is smaller than. The repeating sequence is preceded by a transient of finite length if the reduced fraction also shares a prime factor with the base. A repeating sequence
- An irrational number has a representation of infinite length that is not, from any point, an indefinitely repeating sequence of finite length.
If b is an integer base and k is an integer,
For example in duodecimal:
which is 0.. 10 is 12, 102 is 144, 21 is 25, ᘔ5 is 125,...
Algorithm for positive bases
For a rational there is the following algorithm producing the repetend together with its length:function b_adic // b ≥ 2; 0 < p < q
static digits = "0123..."; // up to the digit with value b–1
begin
s = ""; // the string of digits
pos = 0; // all places are right to the radix point
while not defined do
occurs = pos; // the position of the place with remainder p
z = floor; // index z of digit within: 0 ≤ z ≤ b-1
p = p*b − z*q; // 0 ≤ p < q
if p = 0 then L = 0; return ; end if
s = s.substring; // append the character of the digit
pos += 1;
end while
L = pos - occurs; // the length of the repetend
// mark the digits of the repetend by a vinculum:
for i from occurs to pos-1 do
substring = overline;
end for
return ;
end function
The first line highlighted yellow 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 havethus
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.Applications to cryptography
Repeating decimals have found cryptographic and error-correction coding applications. In these applications repeating decimals to base 2 are generally used which gives rise to binary sequences. The maximum length binary sequence for is given by:These sequences of period p − 1 have an autocorrelation function that has a negative peak of −1 for shift of. The randomness of these sequences has been examined by diehard tests.