Repeating Decimal
Get Repeating Decimal essential facts below. View Videos or join the Repeating Decimal discussion. Add Repeating Decimal to your PopFlock.com topic list for future reference or share this resource on social media.
Repeating Decimal

A repeating decimal or recurring decimal is decimal representation of a number whose digits are periodic (repeating its values at regular intervals) 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 (i.e. all except finitely many digits are zero). 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.[1] Every terminating decimal representation can be written as a decimal fraction, a fraction whose denominator is a power of 10 (e.g. ); it may also be written as a ratio of the form (e.g. ). 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 (rightmost) non-zero digit by one and appending a repetend of 9. and are two examples of this. (This type of repeating decimal can be obtained by long division if one uses a modified form of the usual division algorithm.[2])

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 ?.

## 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 (a vinculum) above the repetend. (See examples in table below, column Vinculum.)
• 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. (See examples in table below, column Dots.)
• In parts of Europe and Vietnam, the convention is to enclose the repetend in parentheses. (See examples in table below, column 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. (See examples in table below, column Arc.)
• Informally, repeating decimals are often represented by an ellipsis (three periods, 0.333...), 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.... (See examples in table below, column Ellipsis.)
Examples
Fraction Vinculum Dots Parentheses Arc Ellipsis
0.1 ${\displaystyle 0.{\dot {1}}}$ 0.(1) ${\displaystyle 0.{\overset {\frown }{1}}}$ 0.111...
= 0.3 ${\displaystyle 0.{\dot {3}}}$ 0.(3) ${\displaystyle 0.{\overset {\frown }{3}}}$ 0.333...
= 0.6 ${\displaystyle 0.{\dot {6}}}$ 0.(6) ${\displaystyle 0.{\overset {\frown }{6}}}$ 0.666...
= 0.81 ${\displaystyle 0.{\dot {8}}{\dot {1}}}$ 0.(81) ${\displaystyle 0.{\overset {\frown }{81}}}$ 0.8181...
= 0.583 ${\displaystyle 0.58{\dot {3}}}$ 0.58(3) ${\displaystyle 0.58{\overset {\frown }{3}}}$ 0.58333...
= 0.142857 ${\displaystyle 0.{\dot {1}}4285{\dot {7}}}$ 0.(142857) [3] 0.142857142857...
= 0.012345679 ${\displaystyle 0.{\dot {0}}1234567{\dot {9}}}$ 0.(012345679) [3] 0.012345679012345679...
= 3.142857 ${\displaystyle 3.{\dot {1}}4285{\dot {7}}}$ 3.(142857) [3] 3.142857142857...

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".

### 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.0675
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: 0.0675675675....

### 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".[4]

### 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

Fraction Expansion L Fraction Expansion L Fraction Expansion L
0.5 0 0.0588235294117647 16 0.03125 0
0.3 1 0.05 1 0.03 2
0.25 0 0.052631578947368421 18 0.02941176470588235 16
0.2 0 0.05 0 0.0285714 6
0.16 1 0.047619 6 0.027 1
0.142857 6 0.045 2 0.027 3
0.125 0 0.0434782608695652173913 22 0.0263157894736842105 18
0.1 1 0.0416 1 0.025641 6
0.1 0 0.04 0 0.025 0
0.09 2 0.0384615 6 0.02439 5
0.083 1 0.037 3 0.0238095 6
0.076923 6 0.03571428 6 0.023255813953488372093 21
0.0714285 6 0.0344827586206896551724137931 28 0.0227 2
0.06 1 0.03 1 0.02 1
0.0625 0 0.032258064516129 15 0.02173913043478260869565 22

Thereby L is the length of the repetend.

The repetend lengths of , n = 1, 2, 3, ..., are:

0, 0, 1, 0, 0, 1, 6, 0, 1, 0, 2, 1, 6, 6, 1, 0, 16, 1, 18, 0, 6, 2, 22, 1, 0, 6, 3, 6, 28, 1, 15, 0, 2, 16, 6, 1, 3, 18, 6, 0, 5, 6, 21, 2, 1, 22, 46, 1, 42, 0, 16, 6, 13, 3, 2, 6, 18, 28, 58, 1, 60, 15, 6, 0, 6, 2, 33, 16, 22, 6, 35, 1, 8, 3, 1, ... (sequence in the OEIS).

The repetends of , n = 1, 2, 3, ..., are:

0, 0, 3, 0, 0, 6, 142857, 0, 1, 0, 09, 3, 076923, 714285, 6, 0, 0588235294117647, 5, 052631578947368421, 0, 047619, 45, 0434782608695652173913, 6, 0, 384615, 037, 571428, 0344827586206896551724137931, 3, ... (sequence in the OEIS).

The repetend lengths of , p = 2, 3, 5, ... (nth prime), are:

0, 1, 0, 6, 2, 6, 16, 18, 22, 28, 15, 3, 5, 21, 46, 13, 58, 60, 33, 35, 8, 13, 41, 44, 96, 4, 34, 53, 108, 112, 42, 130, 8, 46, 148, 75, 78, 81, 166, 43, 178, 180, 95, 192, 98, 99, 30, 222, 113, 228, 232, 7, 30, 50, 256, 262, 268, 5, 69, 28, ... (sequence in the OEIS).

The least primes p for which has repetend length n, n = 1, 2, 3, ..., are:

3, 11, 37, 101, 41, 7, 239, 73, 333667, 9091, 21649, 9901, 53, 909091, 31, 17, 2071723, 19, 1111111111111111111, 3541, 43, 23, 11111111111111111111111, 99990001, 21401, 859, 757, 29, 3191, 211, ... (sequence in the OEIS).

The least primes p for which has n different cycles , n = 1, 2, 3, ..., are:

7, 3, 103, 53, 11, 79, 211, 41, 73, 281, 353, 37, 2393, 449, 3061, 1889, 137, 2467, 16189, 641, 3109, 4973, 11087, 1321, 101, 7151, 7669, 757, 38629, 1231, ... (sequence in the OEIS).

## Fractions with prime denominators

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 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.[5]

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.142857, 6 repeating digits
• = 0.0588235294117647, 16 repeating digits
• = 0.052631578947368421, 18 repeating digits
• = 0.0434782608695652173913, 22 repeating digits
• = 0.0344827586206896551724137931, 28 repeating digits
• = 0.0212765957446808510638297872340425531914893617, 46 repeating digits
• = 0.0169491525423728813559322033898305084745762711864406779661, 58 repeating digits
• = 0.016393442622950819672131147540983606557377049180327868852459, 60 repeating digits
• = 0.010309278350515463917525773195876288659793814432989690721649484536082474226804123711340206185567, 96 repeating digits

The list can go on to include the fractions , , , , , , , , etc. (sequence in the OEIS).

Every proper multiple of a cyclic number (that is, a multiple having the same number of digits) 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...

The reason for the cyclic behavior is apparent from an arithmetic exercise of long division of : the sequential remainders are the cyclic sequence . 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 starts '142' and is followed by '857' while (by rotation) 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 (namely, times). They are:[6]:166

61, 131, 181, 461, 491, 541, 571, 701, 811, 821, 941, 971, 1021, 1051, 1091, 1171, 1181, 1291, 1301, 1349, 1381, 1531, 1571, 1621, 1741, 1811, 1829, 1861,... (sequence in the OEIS).

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

7, 23, 47, 59, 167, 179, 263, 383, 503, 863, 887, 983, 1019, 1367, 1487, 1619, 1823,... (sequence in the OEIS).

### Other reciprocals of primes

Some reciprocals of primes that do not generate cyclic numbers are:

• = 0.3, which has a period (repetend length) of 1.
• = 0.09, which has a period of 2.
• = 0.076923, which has a period of 6.
• = 0.032258064516129, which has a period of 15.
• = 0.027, which has a period of 3.
• = 0.02439, which has a period of 5.
• = 0.023255813953488372093, which has a period of 21.
• = 0.0188679245283, which has a period of 13.
• = 0.014925373134328358208955223880597, which has a period of 33.

(sequence 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 , 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

${\displaystyle {\frac {10^{11-1}-1}{11}}=909090909}$

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...,

where the repetend of each fraction is a cyclic re-arrangement of 076923. The second set is:

• = 0.153846...
• = 0.538461...
• = 0.384615...
• = 0.846153...
• = 0.461538...
• = 0.615384...,

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.

### Totient rule

For an arbitrary integer n, the length ?(n) of the repetend of divides ?(n), where ? is the totient function. The length is equal to ?(n) if and only if 10 is a primitive root modulo n.[7]

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:

= 0.020408163265306122448979591836734693877551.

The period (repetend length) 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

${\displaystyle a^{m}\equiv 1{\pmod {n}}}$

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 (sequence in the OEIS).[8]

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 :

119 = 7 × 17
?(7 × 17) = LCM(?(7), ?(17)) = LCM(6, 16) = 48,

where LCM denotes the least common multiple.

The period T of is a factor of ?(pq) and it happens to be 48 in this case:

= 0.008403361344537815126050420168067226890756302521.

The period T of is LCM(TpTq), 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

${\displaystyle {\frac {1}{p^{k}q^{l}r^{m}\cdots }}}$

is a repeating decimal with a period of

${\displaystyle \operatorname {LCM} (T_{p^{k}},T_{q^{l}},T_{r^{m}},\ldots )}$

where Tpk, Tql, Trm,... are respectively the period of the repeating decimals , , ,... as defined above.

## Reciprocals of integers not coprime to 10

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:

${\displaystyle {\frac {1}{2^{a}5^{b}p^{k}q^{l}\cdots }}\,,}$

where a and b are not both zero.

This fraction can also be expressed as:

${\displaystyle {\frac {5^{a-b}}{10^{a}p^{k}q^{l}\cdots }}\,,}$

if a > b, or as

${\displaystyle {\frac {2^{b-a}}{10^{b}p^{k}q^{l}\cdots }}\,,}$

if b > a, or as

${\displaystyle {\frac {1}{10^{a}p^{k}q^{l}\cdots }}\,,}$

if a = b.

The decimal has:

• An initial transient of max(ab) 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 .

For example = 0.03571428:

• 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

Given a repeating decimal, it is possible to calculate the fraction that produced it. For example:

{\displaystyle {\begin{alignedat}{1}x&=0.333333\ldots \\10x&=3.333333\ldots \quad &{\text{(multiplying each side of the above line by 10)}}\\9x&=3&{\text{(subtracting the 1st line from the 2nd)}}\\x&={\frac {3}{9}}={\frac {1}{3}}&{\text{(reducing to lowest terms)}}\\\end{alignedat}}}

Another example:

{\displaystyle {\begin{alignedat}{1}x&=\ \ \ \ 0.836363636\ldots \\10x&=\ \ \ \ 8.36363636\ldots \quad &{\text{(multiplying by a power of 10 to move decimal to start of repetition)}}\\1000x&=836.36363636\ldots &{\text{(multiplying by a power of 100 to move decimal to end of first repeating decimal)}}\\990x&=828&{\text{(subtracting to clear decimals)}}\\x&={\frac {828}{990}}={\frac {18\times 46}{18\times 55}}={\frac {46}{55}}.\end{alignedat}}}

### 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:

{\displaystyle {\begin{aligned}x&=0.000000100000010000001\ldots \\10^{7}x&=1.000000100000010000001\ldots \\\left(10^{7}-1\right)x=9999999x&=1\\x&={\frac {1}{10^{7}-1}}={\frac {1}{9999999}}\end{aligned}}}

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:

{\displaystyle {\begin{aligned}7.48181818\ldots &=7.3+0.18181818\ldots \\[8pt]&={\frac {73}{10}}+{\frac {18}{99}}={\frac {73}{10}}+{\frac {9\times 2}{9\times 11}}={\frac {73}{10}}+{\frac {2}{11}}\\[12pt]&={\frac {11\times 73+10\times 2}{10\times 11}}={\frac {823}{110}}\end{aligned}}}

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:

{\displaystyle {\begin{aligned}x&=0.{\overline {a_{1}a_{2}\cdots a_{n}}}\\10^{n}x&=a_{1}a_{2}\cdots a_{n}.{\overline {a_{1}a_{2}\cdots a_{n}}}\\\left(10^{n}-1\right)x=99\cdots 99x&=a_{1}a_{2}\cdots a_{n}\\x&={\frac {a_{1}a_{2}\cdots a_{n}}{10^{n}-1}}={\frac {a_{1}a_{2}\cdots a_{n}}{99\cdots 99}}\end{aligned}}}

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 digits 9. For example,

• 0.444444... = since the repeating block is 4 (a 1-digit block),
• 0.565656... = since the repeating block is 56 (a 2-digit block),
• 0.012012... = since the repeating block is 012 (a 3-digit block); this further reduces to .
• 0.999999... = = 1, since the repeating block is 9 (also a 1-digit block)

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,

• 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.

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,

• 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 = − + = =

An even faster method is to ignore the decimal point completely and go like this

• 1.23444... = = (denominator has one 9 and two 0s because one digit repeats and there are two non-repeating digits after the decimal point)
• 0.3789789... = = (denominator has three 9s and one 0 because three digits repeat and there is one non-repeating digit after the decimal point)

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 will be (at most) 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,

${\displaystyle 0.{\overline {1}}={\frac {1}{10}}+{\frac {1}{100}}+{\frac {1}{1000}}+\cdots =\sum _{n=1}^{\infty }{\frac {1}{10^{n}}}}$

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.

${\displaystyle {\frac {a}{1-r}}={\frac {\frac {1}{10}}{1-{\frac {1}{10}}}}={\frac {1}{10-1}}={\frac {1}{9}}}$

Similarly,

{\displaystyle {\begin{aligned}0.{\overline {142857}}&={\frac {142857}{10^{6}}}+{\frac {142857}{10^{12}}}+{\frac {142857}{10^{18}}}+\cdots =\sum _{n=1}^{\infty }{\frac {142857}{10^{6n}}}\\[6px]\implies &\quad {\frac {a}{1-r}}={\frac {\frac {142857}{10^{6}}}{1-{\frac {1}{10^{6}}}}}={\frac {142857}{10^{6}-1}}={\frac {142857}{999999}}={\frac {1}{7}}\end{aligned}}}

## 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 (periods) are given by Mitchell[9] and Dickson.[10]

• 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(ab), 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
${\displaystyle {\text{period}}\left({\frac {1}{p}}\right)={\text{period}}\left({\frac {1}{p^{2}}}\right)=\cdots ={\text{period}}\left({\frac {1}{p^{m}}}\right)}$
for some m, but
${\displaystyle {\text{period}}\left({\frac {1}{p^{m}}}\right)\neq {\text{period}}\left({\frac {1}{p^{m+1}}}\right),}$
then for c >= 0 we have
${\displaystyle {\text{period}}\left({\frac {1}{p^{m+c}}}\right)=p^{c}\cdot {\text{period}}\left({\frac {1}{p}}\right).}$
• 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.

For some other properties of repetends, see also.[11]

## 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 (the generalization of a decimal point to non-decimal systems) 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 Q and R.
• If the positional numeral system is a standard one, that is it has base
${\displaystyle b\in \mathbb {Z} \setminus \{-1,0,1\}}$
combined with a consecutive set of digits
${\displaystyle D:=\{d_{1},d_{1}+1,\dots ,d_{r}\}}$
with r := ||, dr := d1 + r - 1 and 0 ? D, then a terminating sequence is obviously equivalent to the same sequence with non-terminating repeating part consisting of the digit 0. If the base is positive, then there exists an order homomorphism from the lexicographical order of the right-sided infinite strings over the alphabet D into some closed interval of the reals, which maps the strings 0.A1A2...Andb and 0.A1A2...(An+1)d1 with Ai ? D and An ? db to the same real number - and there are no other duplicate images. In the decimal system, for example, there is 0.9 = 1.0 = 1; in the balanced ternary system there is 0.1 = 1.T = .
• A rational number has an indefinitely repeating sequence of finite length l, if the reduced fraction's denominator contains a prime factor that is not a factor of the base. If q is the maximal factor of the reduced denominator which is coprime to the base, l is the smallest exponent such that q divides bl - 1. It is the multiplicative order ordq(b) of the residue class b mod q which is a divisor of the Carmichael function λ(q) which in turn is smaller than q. 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
${\displaystyle (0.{\overline {A_{1}A_{2}\ldots A_{l}}})_{b}}$
represents the fraction
${\displaystyle {\frac {\left({A_{1}A_{2}\ldots A_{l}}\right)_{b}}{b^{l}-1}}}$.
• An irrational number has a representation of infinite length that is not, from any point, an indefinitely repeating sequence of finite length.

For example, in duodecimal, = 0.6, = 0.4, = 0.3 and = 0.2 all terminate; = 0.2497 repeats with period length 4, in contrast with the equivalent decimal expansion of 0.2; = 0.186?35 has period 6 in duodecimal, just as it does in decimal.

If b is an integer base and k is an integer,

${\displaystyle {\frac {1}{k}}={\frac {1}{b}}+{\frac {(b-k)^{1}}{b^{2}}}+{\frac {(b-k)^{2}}{b^{3}}}+{\frac {(b-k)^{3}}{b^{4}}}+{\frac {(b-k)^{4}}{b^{5}}}+\cdots +{\frac {(b-k)^{N-1}}{b^{N}}}+\cdots }$

For example in duodecimal:

= ( + + + + + + ...)base 12

which is 0.186?35 (base 12). 10 (base 12) is 12 (base 10), 102 (base 12) is 144 (base 10), 21 (base 12) is 25 (base 10), ?5 (base 12) is 125 (base 10), ...

### Algorithm for positive bases

For a rational 0 < < 1 (and base b ? N>1) there is the following algorithm producing the repetend together with its length:

function b_adic(b,p,q) // 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(occurs[p]) do
occurs[p] = pos;  // the position of the place with remainder p
bp = b*p;
z = floor(bp/q); // index z of digit within: 0
p = b*p - z*q;    // 0
if p = 0 then L = 0; return (s); end if
s = s.substring(digits, z, 1); // append the character of the digit
pos += 1;
end while
L = pos - occurs[p]; // the length of the repetend (being < q)
// mark the digits of the repetend by a vinculum:
for i from occurs[p] to pos-1 do
substring(s, i, 1) = overline(substring(s, i, 1));
end for
return (s);
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 have

${\displaystyle {\frac {bp}{q}}-1\;\;<\;\;z=\left\lfloor {\frac {bp}{q}}\right\rfloor \;\;\leq \;\;{\frac {bp}{q}},}$

thus

${\displaystyle bp-q

and

${\displaystyle zq\leq bp\quad \implies \quad 0\leq bp-zq=:p'\,.}$

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).

## Applications to cryptography

Repeating decimals (also called decimal sequences) have found cryptographic and error-correction coding applications.[12] In these applications repeating decimals to base 2 are generally used which gives rise to binary sequences. The maximum length binary sequence for (when 2 is a primitive root of p) is given by:[13]

${\displaystyle a(i)=2^{i}~{\bmod {p}}~{\bmod {2}}}$

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.[14]

## References and remarks

1. ^ 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.
2. ^ Beswick, Kim (2004), "Why Does 0.999... = 1?: A Perennial Question and Number Sense", Australian Mathematics Teacher, 60 (4): 7-9
3. ^ a b c As of 1 February 2018, overarcs are limited to 1 or 2 digit(s) in Wikipedia.
4. ^ For a base b and a divisor n, in terms of group theory this length divides
${\displaystyle \operatorname {ord} _{n}(b):=\min\{L\in \mathbb {N} \,\mid \,b^{L}\equiv 1{\text{ mod }}n\}}$
(with modular arithmetic ) which divides the Carmichael function
${\displaystyle \lambda (n):=\max\{\operatorname {ord} _{n}(b)\,\mid \,\gcd(b,n)=1\}}$
which again divides Euler's totient function ?(n).
5. ^ Gray, Alexander J., "Digital roots and reciprocals of primes", Mathematical Gazette 84.09, March 2000, 86.
6. ^ Dickson, L. E., History of the Theory of Numbers, Volume 1, Chelsea Publishing Co., 1952.
7. ^ William E. Heal. Some Properties of Repetends. Annals of Mathematics, Vol. 3, No. 4 (Aug., 1887), pp. 97-103
8. ^ Albert H. Beiler, Recreations in the Theory of Numbers, p 79
9. ^ Mitchell, Douglas W., "A nonlinear random number generator with known, long cycle length", Cryptologia 17, January 1993, 55–62.
10. ^ Dickson, Leonard E., History of the Theory of Numbers, Vol. I, Chelsea Publ. Co., 1952 (orig. 1918), 164–173.
11. ^ Armstrong, N. J., and Armstrong, R. J., "Some properties of repetends", Mathematical Gazette 87, November 2003, 437-443.
12. ^ Kak, Subhash, Chatterjee, A. "On decimal sequences". IEEE Transactions on Information Theory, vol. IT-27, pp. 647-652, September 1981.
13. ^ Kak, Subhash, "Encryption and error-correction using d-sequences". IEEE Trans. On Computers, vol. C-34, pp. 803-809, 1985.
14. ^ Bellamy, J. "Randomness of D sequences via diehard testing". 2013. arXiv:1312.3618

This article uses material from the Wikipedia page available here. It is released under the Creative Commons Attribution-Share-Alike License 3.0.