Fact-checked by Grok 2 weeks ago

Repeating decimal

A repeating decimal, also known as a recurring decimal, is a of a in which one or more digits after the decimal point repeat indefinitely in a periodic pattern. These patterns can be purely repeating, starting immediately after the decimal point (e.g., \frac{1}{3} = 0.\overline{3}), or eventually repeating, with a non-repeating prefix followed by the cycle (e.g., \frac{1}{6} = 0.1\overline{6}). The repeating sequence is termed the repetend, and the length of this sequence is called the period. Repeating decimals are intrinsically linked to rational numbers, as every fraction with a denominator whose prime factors include numbers other than 2 or 5 (in lowest terms) produces a non-terminating repeating decimal expansion. Conversely, a foundational result in real number theory states that a is rational if and only if its decimal expansion is either terminating (which can be viewed as repeating zeros) or eventually periodic. This periodicity arises from the algorithm for fractions, where remainders cycle after a finite number of steps, bounded by the denominator. For instance, the period of \frac{1}{7} = 0.\overline{142857} is 6, reflecting the order of 10 modulo 7 in the multiplicative group. The concept of repeating decimals emerged with the development of decimal notation in the late 16th century, primarily through the work of Flemish mathematician , who in his 1585 treatise De Thiende (The Tenth) systematically introduced decimal fractions. Stevin's innovations facilitated practical applications in commerce and engineering, building on earlier fragmentary uses of decimals in and , but his efforts standardized their representation in . By the 18th century, the equivalence between repeating decimals and rationals was more rigorously established, confirming that irrational numbers have non-repeating decimal expansions. Today, repeating decimals underpin topics in , such as the study of decimal periods and their connections to cyclotomic polynomials.

Fundamentals

Notation

A repeating decimal is a decimal representation in which a sequence of one or more digits repeats indefinitely after an optional initial non-repeating part. Repeating decimals are categorized as pure repeating, where the repeating sequence begins immediately after the decimal point (such as $0.\overline{3} = 0.333\ldots), or mixed repeating (also called eventually repeating), which features a finite non-repeating prefix followed by the repeating portion (such as $0.1\overline{6} = 0.1666\ldots). The conventional notation employs a vinculum, or overbar, placed above the repeating digits to indicate the repetend, the block that cycles. For instance, $0.\overline{12} = 0.121212\ldots denotes the sequence "12" repeating from the start, while the overbar in mixed cases applies only to the cycling part. Alternative conventions include dots positioned above the first and last digits of the repetend, as in $0.\dot{1}\dot{2} = 0.121212\ldots for the two-digit repetend "12", or parentheses enclosing the sequence for clarity, such as $0.(3) = 0.333\ldots. The vinculum notation traces its origins to 16th-century European mathematicians, with Simon Stevin employing horizontal lines over or under digit groups in decimal fractions in his 1585 treatise De Thiende to signify aggregation and structure in expansions. This practice evolved into the modern overbar for marking repetition in decimals by the .

Decimal Expansion and Recurrence

The decimal expansion of a \frac{p}{q}, where p and q are with q \neq 0, is generated by performing of p by q in base 10. This process begins after any integer part by multiplying the current by 10 and dividing by q to produce successive decimal digits, along with a new between 0 and q-1. A repeating decimal arises when, during , a repeats a value encountered earlier in the process, causing the sequence of digits to cycle indefinitely from that point onward. Since there are only finitely many possible (at most q), is inevitable unless the reaches zero, which would terminate the expansion. The repeating cycle, or repetend, corresponds to the digits produced between the repeated . For instance, consider the of \frac{1}{3}. Dividing 1 by 3 yields an initial of 0 and 1. Multiplying the remainder by 10 gives 10, which divides by 3 to produce 3 and 1 again. This generates $0.333\ldots, or $0.\overline{3}, where the single 3 repeats due to the persistent . Repetition occurs in the of \frac{p}{q} (in lowest terms) whenever q has prime factors other than 2 and 5, as these additional factors prevent the remainders from resolving to zero and instead create a finite of nonzero remainders. If q factors solely into powers of 2 and/or 5 after simplifying, the terminates. In cases with mixed factors, a non-repeating precedes the , with its length equal to the maximum of the exponents of 2 and 5 in the prime of q. For example, in \frac{1}{6} = \frac{1}{2 \times 3} = 0.1\overline{6}, the exponent of 2 is 1 (higher than that of 5, which is 0), yielding a non-repeating "1" before the repeating "6".

Rationality and Proofs

Terminating and Repeating Decimals as

A fundamental result in is that every terminating decimal and every repeating decimal represents a , expressible as the ratio p/q where p and q are with q \neq 0. Terminating decimals, which end after a finite number of digits, can be rewritten as fractions with a denominator that is a , such as $10^k for some positive k. Since $10^k = 2^k \cdot 5^k, this denominator factors only into primes 2 and 5, allowing reduction to a simple rational form. For example, $0.5 = 5/10 = 1/2, and $0.25 = 25/100 = 1/4. Repeating decimals, denoted with a bar over the repeating sequence (e.g., $0.\overline{3}), can be expressed as an infinite that sums to a . Consider $0.\overline{3} = 0.3 + 0.03 + 0.003 + \cdots, a with first term a = 0.3 and common ratio r = 0.1. The sum is a / (1 - r) = 0.3 / (1 - 0.1) = 0.3 / 0.9 = 1/3. Similarly, $0.\overline{27} = 0.27 + 0.0027 + 0.000027 + \cdots = 27/99 = 3/11. In contrast, irrational numbers like \pi \approx 3.14159\ldots have decimal expansions that are non-terminating and non-repeating, distinguishing them from .

Rationals as Terminating or Repeating Decimals

Every possesses a decimal expansion that is either terminating (finite) or eventually repeating (periodic). This fundamental property distinguishes from , whose expansions neither terminate nor repeat. Consider a rational number expressed as \frac{p}{q} in lowest terms, where p and q are integers with q > 0 and \gcd(p, q) = 1. The decimal expansion terminates the prime factors of q are solely 2 and/or 5. In such cases, q divides some (since $10^k = 2^k \cdot 5^k), allowing the fraction to be rewritten with a denominator that is a , resulting in a finite number of decimal places. Otherwise, if q has any prime factor other than 2 or 5, the expansion is non-terminating but eventually repeating, with the length of the repeating (repetend) dividing the multiplicative of 10 the part of q coprime to 10. This behavior arises naturally from the algorithm used to compute the decimal expansion. In dividing p by q, each step produces a and a r_k satisfying $0 \leq r_k < q. If a remainder of zero occurs, the division terminates. Otherwise, the remainders form an infinite sequence taking values in the finite set {1, 2, \dots, q-1}. By the pigeonhole principle, after at most q steps, at least two remainders must coincide, say r_j = r_k with j < k. The s produced between these steps then repeat indefinitely, yielding a periodic expansion starting from the j-th decimal place. For illustration, the fraction \frac{1}{2} = 0.5 terminates, as 2 is a factor of 10. In contrast, \frac{1}{3} = 0.\overline{3} repeats with period 1, since 3 is coprime to 10. A mixed case is \frac{1}{6} = 0.1\overline{6}, where the non-repeating prefix arises from the factor of 2 in 6, followed by repetition due to the factor of 3. Notably, certain rational numbers admit two distinct decimal representations. Terminating decimals can be expressed either with trailing zeros or with trailing nines. For example, \frac{1}{2} = 0.5000\dots = 0.4999\dots, where the equivalence holds because the infinite series $0.4999\dots = 0.4 + 0.09 + 0.009 + \dots = \frac{4}{10} + \frac{9}{100} + \frac{9}{1000} + \dots = \frac{4}{10} + \frac{9}{90} = \frac{1}{2}. This non-uniqueness applies precisely to rationals that terminate in one representation.

Formal Proofs

To prove that every repeating decimal represents a rational number, consider a general repeating decimal r = q.d_1 d_2 \dots d_k \overline{d_{k+1} \dots d_n}, where q is the integer part, the first k digits after the decimal are non-repeating, and the block d_{k+1} \dots d_n repeats with period n - k. Multiplying by $10^k shifts the decimal point past the non-repeating part:
$10^k r = (10^k q + d_1 10^{k-1} + \dots + d_k) . \overline{d_{k+1} \dots d_n}.
Multiplying by $10^n shifts past the non-repeating part and one full period:
$10^n r = (10^n q + d_1 10^{n-1} + \dots + d_n) . \overline{d_{k+1} \dots d_n}.
Subtracting these equations aligns the repeating parts:
$10^n r - 10^k r = (10^n q + d_1 10^{n-1} + \dots + d_n) - (10^k q + d_1 10^{k-1} + \dots + d_k),
where the right side is an integer, say m. Thus,
r (10^n - 10^k) = m,
so
r = \frac{m}{10^n - 10^k} = \frac{m}{10^k (10^{n-k} - 1)},
which is a ratio of integers, proving r is rational.
For a pure repeating decimal with no non-repeating part (k = 0), such as r = 0.\overline{d_1 \dots d_k}, the formula simplifies. Let s be the integer formed by the digits d_1 \dots d_k. Then
r = \frac{s}{10^k - 1},
as derived by multiplying r by $10^k and subtracting:
$10^k r - r = s,
yielding r (10^k - 1) = s. This expresses r as a rational with denominator $999\dots 9 (k nines).
Conversely, every rational number has a decimal expansion that is either terminating or eventually repeating. Consider a rational \frac{a}{b} in lowest terms, with a, b integers and b > 0. Performing of a by b generates a sequence of remainders r_1, r_2, \dots, each satisfying $0 \leq r_i < b. Since there are only b possible remainders (0 through b-1), by the pigeonhole principle, either some remainder is 0 (causing termination) or two remainders repeat, say r_i = r_j with i < j. In the latter case, the digits from position i onward repeat with period j - i, making the expansion eventually periodic. For mixed repeating decimals, the length of the non-repeating part equals the maximum of the exponents of 2 and 5 in the prime factorization of b. Write b = 2^m 5^n q, where q > 1 is coprime to 10 (i.e., has no factors of 2 or 5). The decimal terminates if q = 1 (after \max(m, n) digits); otherwise, it has a non-repeating prefix of length \max(m, n) followed by a repeating part determined by q. To see this, multiply numerator and denominator by $5^{\max(m,n) - m} 2^{\max(m,n) - n} to make the denominator $10^{\max(m,n)} q, yielding a terminating part from the powers of 10 and a repeating part from dividing by q (which, by the pigeonhole argument, cycles after at most q-1 steps). Terminating decimals admit a : one ending in infinite 0s and an equivalent one ending in infinite 9s. For example, consider $1 = 1.000\dots = 0.999\dots. To prove $0.999\dots = 1, let x = 0.999\dots. Then $10x = 9.999\dots, so $10x - x = 9.999\dots - 0.999\dots = 9, yielding $9x = 9 and x = 1. Alternatively, as an infinite , $0.999\dots = \sum_{k=1}^\infty 9 \cdot 10^{-k} = 9 \cdot \frac{10^{-1}}{1 - 10^{-1}} = 9 \cdot \frac{1/10}{9/10} = 1. This duality arises because the series converges to the same , and in the real numbers, these representations are identical.

Common Examples

Table of Values

The following table summarizes the decimal expansions of fractions $1/n for n = 1 to $20, showcasing terminating decimals, purely repeating decimals, and eventually repeating (mixed) forms. These expansions are standard representations derived from processes.
nDecimal Expansion of $1/n
1$1.0
2$0.5
3$0.\overline{3}
4$0.25
5$0.2
6$0.1\overline{6}
7$0.\overline{142857}
8$0.125
9$0.\overline{1}
10$0.1
11$0.\overline{09}
12$0.08\overline{3}
13$0.\overline{076923}
14$0.0\overline{714285}
15$0.0\overline{6}
16$0.0625
17$0.\overline{0588235294117647}
18$0.0\overline{5}
19$0.\overline{052631578947368421}
20$0.05
This table illustrates key patterns in repeating decimals, including short periods for small prime denominators like period 1 for $1/3 and $1/9, and longer periods for larger primes such as the full 6-digit cycle in $1/7. Terminating expansions appear when the denominator factors into powers of 2 and/or 5, as seen in entries for n=2,4,5,8,10,16,20. The examples in this table exemplify the earlier theorems on rational numbers, confirming that every yields either a terminating or a repeating decimal expansion in base 10.

Reciprocals of Primes

For prime numbers p > 5, the reciprocal $1/p produces a pure expansion in base 10, meaning the repetition begins immediately after the decimal point with no non-repeating digits. The length of this repeating block, known as the repetend or period, is given by the multiplicative order of 10 p, denoted \operatorname{ord}_p(10), which is the smallest positive k such that $10^k \equiv 1 \pmod{p}. This order exists because p is coprime to 10, ensuring 10 is invertible p. By , since \gcd(10, p) = 1, the order \operatorname{ord}_p(10) divides \phi(p) = p-1, where \phi is . Thus, the period of $1/p is a of p-1. When the order equals p-1, the period achieves its maximum length, and p is called a ; in such cases, the repetend forms a , an integer whose digits, when multiplied by integers from 1 to p-1, yield cyclic permutations of the original digits. A classic example is p = 7, where \operatorname{ord}_7(10) = 6 = 7-1, so $1/7 = 0.\overline{142857}. The repetend 142857 is a : multiplying by 2 gives $2/7 = 0.\overline{285714}, by 3 gives $3/7 = 0.\overline{428571}, and so on up to $6/7 = 0.\overline{857142}, each a of the same digits. For primes with shorter periods, such as p = 11 where \operatorname{ord}_{11}(10) = 2 (dividing 10), $1/11 = 0.\overline{09}. Similarly, for p = 13 with \operatorname{ord}_{13}(10) = 6 (dividing 12), $1/13 = 0.\overline{076923}. These properties highlight the connection between decimal expansions and the structure of the multiplicative group modulo p.

Reciprocals of Composites Coprime to 10

When the denominator n of the reciprocal $1/n is a composite integer coprime to 10, the length of the repeating decimal period, known as the repetend length, is the multiplicative order of 10 modulo n, which is the smallest positive integer k such that $10^k \equiv 1 \pmod{n}. This order equals the least common multiple (LCM) of the orders of 10 modulo each prime power p^k in the prime factorization of n, due to the Chinese Remainder Theorem decomposing the multiplicative group modulo n into a direct product of groups modulo the prime powers. For odd primes p \neq 5, the order modulo p^k is a multiple of the order modulo p, and equals it in some cases but can be larger in others, so the period of $1/n is the LCM of the orders modulo its prime power factors. Building on the periods for prime denominators, compositeness allows the overall period to be computed via LCM, which can either shorten the effective relative to the size of n (if factors share common divisors) or extend it beyond individual prime s (if the prime s are whose LCM is their product). For instance, the of $1/9 = 1/3^2 = 0.\overline{1} is 1, matching the of $1/3. Another example is $1/21 = 1/(3 \times 7) = 0.\overline{047619}, where the is \operatorname{LCM}(1, 6) = 6, combining the of 1 (from $1/3) and 6 (from $1/7). Similarly, for $1/77 = 1/(7 \times 11) = 0.\overline{012987}, the is \operatorname{LCM}(6, 2) = 6, using the s from $1/7 and $1/11 = 0.\overline{09}. In some cases, the repeating may include leading zeros within the repetend, giving the appearance of a non-full , though the decimal is purely periodic since \gcd(n, 10) = 1. For example, $1/33 = 1/(3 \times 11) = 0.\overline{03}, with \operatorname{LCM}(1, 2) = 2, but the "03" starts with a zero after the decimal point. This compositeness effect highlights how the LCM mechanism can produce periods that are multiples of prime factors' periods, often resulting in longer cycles for products of primes with distinct period lengths compared to the primes alone, while keeping the maximum possible bounded by the Carmichael function \lambda(n).

Conversion Techniques

Repeating Decimals to Fractions

One common algebraic technique to convert a repeating decimal to its exact fractional equivalent involves setting up an with a representing the decimal and using by powers of 10 to align the repeating portions for . For a purely repeating decimal of the form x = 0.\overline{a_1 a_2 \dots a_k}, where the block a_1 a_2 \dots a_k of length k repeats indefinitely, multiply x by $10^k to shift the decimal point by k places. This yields $10^k x = a_1 a_2 \dots a_k . \overline{a_1 a_2 \dots a_k}. Subtract the original equation: $10^k x - x = a_1 a_2 \dots a_k . \overline{a_1 a_2 \dots a_k} - 0.\overline{a_1 a_2 \dots a_k}, simplifying to (10^k - 1) x = a_1 a_2 \dots a_k, where the right side is the integer formed by the repeating block. Solving for x gives x = \frac{a_1 a_2 \dots a_k}{10^k - 1}, or equivalently, the repeating block as the numerator over a denominator of k (999...9). For example, consider x = 0.\overline{3}, where k = 1 and the block is 3. Then $10x = 3.\overline{3}, so $10x - x = 3.\overline{3} - 0.\overline{3}, yielding $9x = 3 and x = \frac{3}{9} = \frac{1}{3}. Using the shortcut, this is directly \frac{3}{9}. For a mixed repeating decimal x = 0.b_1 b_2 \dots b_m \overline{a_1 a_2 \dots a_k}, with m non-repeating digits followed by a repeating block of length k, first multiply by $10^m to shift past the non-repeating part: $10^m x = b_1 \dots b_m . \overline{a_1 a_2 \dots a_k}. Then multiply by $10^{m+k} to also shift the repeating block: $10^{m+k} x = b_1 \dots b_m a_1 \dots a_k . \overline{a_1 a_2 \dots a_k}. Subtract the first shifted equation from this: $10^{m+k} x - 10^m x = (b_1 \dots b_m a_1 \dots a_k . \overline{a_1 a_2 \dots a_k}) - (b_1 \dots b_m . \overline{a_1 a_2 \dots a_k}), which simplifies to (10^{m+k} - 10^m) x = b_1 \dots b_m a_1 \dots a_k - b_1 \dots b_m, an on the right. Solving for x provides the , which should then be simplified. As an illustration, take x = 0.1\overline{6}, with m=1 (digit ) and k=1 (repeating 6). Then $10x = 1.\overline{6} and $100x = 16.\overline{6}, so $100x - 10x = 16.\overline{6} - 1.\overline{6}, giving $90x = 15 and x = \frac{15}{90} = \frac{1}{6}. A shortcut for pure repeats treats the entire repeating block as a single numerator unit over the corresponding string of nines; for instance, $0.\overline{abc} (block abc of length 3) equals \frac{abc}{999}, where abc is the three-digit . This approach leverages the fact that \frac{1}{999} = 0.\overline{001}, scaling the numerator accordingly for longer or varied blocks.

Infinite Series Representation

A repeating decimal with a single-digit repetend, such as $0.\overline{d} where d is a from 1 to 9, can be expressed as the infinite \sum_{n=1}^{\infty} \frac{d}{10^n}. This series has first term a = \frac{d}{10} and common ratio r = \frac{1}{10}, so its is \frac{d/10}{1 - 1/10} = \frac{d}{9}. For a pure repeating decimal with repetend period k \geq 1, denoted $0.\overline{a_1 a_2 \dots a_k}, let N be the k-digit integer formed by a_1 a_2 \dots a_k. This decimal equals N \sum_{n=1}^{\infty} \frac{1}{10^{kn}} = N \cdot \frac{1/10^k}{1 - 1/10^k} = \frac{N}{10^k - 1}. For example, $0.\overline{142} = 142 \sum_{n=1}^{\infty} \frac{1}{1000^n} = \frac{142}{999}. A mixed repeating decimal, such as $0.b_1 b_2 \dots b_m \overline{a_1 a_2 \dots a_k} with m \geq 1 non-repeating digits, consists of a finite sum for the non-repeating part plus a geometric series for the repeating part shifted by m places. The non-repeating portion sums to \sum_{i=1}^{m} \frac{b_i}{10^i}, and the repeating portion is \left( \sum_{j=1}^{k} \frac{a_j}{10^{m+j}} \right) \sum_{n=0}^{\infty} \frac{1}{10^{kn}} = r \cdot \frac{1}{1 - 1/10^k}, where r = \sum_{j=1}^{k} \frac{a_j}{10^{m+j}} is the value of the repeating block starting after the non-repeating digits. For instance, $0.1\overline{6} = 0.1 + 0.0\overline{6} = \frac{1}{10} + \frac{6}{90} = \frac{1}{6}. In base 10, these series converge because the common ratio satisfies |r| = 10^{-k} < 1 for any finite k \geq 1, ensuring the partial sums approach a finite limit.

Advanced Properties

Repetend Lengths and Cyclic Numbers

The repetend length, or period, of the decimal expansion of a fraction $1/n in lowest terms is the smallest positive integer k such that the sequence of digits repeats every k places after any initial non-repeating digits. To determine this length, first factor n = 2^a 5^b m where m is coprime to 10; the non-repeating part has length \max(a, b), and the repetend length is the multiplicative order of 10 modulo m, defined as the minimal k > 0 satisfying $10^k \equiv 1 \pmod{m}. This period k always divides Euler's totient function \phi(m), providing an upper bound on possible lengths, though the actual value is the smallest such divisor where the congruence holds. For prime denominators p coprime to 10, the period divides p-1, and maximal periods occur when k = p-1, corresponding to primes where 10 is a primitive root modulo p. These are known as full reptend primes, with examples including 7 (period 6), 17 (period 16), and 19 (period 18). Cyclic numbers arise in the context of full reptend primes, where the repetend of $1/p forms an (p-1)-digit whose multiples by 1 through p-1 yield cyclic permutations of its digits. The most famous example is the repetend 142857 from $1/7 = 0.\overline{142857}, where $142857 \times 1 = 142857, $142857 \times 2 = 285714, $142857 \times 3 = 428571, $142857 \times 4 = 571428, $142857 \times 5 = 714285, and $142857 \times 6 = 857142, each a of the original digits. Such numbers are generated solely by full reptend primes and exhibit this rotational property due to the maximal order of 10 modulo p.

Multiplication and Cyclic Permutations

One prominent illustration of cyclic permutations in repeating decimals arises with the fraction \frac{1}{7} = 0.\overline{142857}, where the six-digit repetend cycles through permutations upon multiplication by integers from 1 to 6. Specifically, \frac{2}{7} = 0.\overline{285714}, \frac{3}{7} = 0.\overline{428571}, \frac{4}{7} = 0.\overline{571428}, \frac{5}{7} = 0.\overline{714285}, and \frac{6}{7} = 0.\overline{857142}, each representing a rotation of the original sequence. In full-period fractions \frac{1}{p}, where p is a prime and the repetend length equals p-1 (indicating that 10 is a primitive root modulo p), multiplication by an integer m with $1 \leq m < p yields a decimal expansion that is a cyclic shift of the original repetend. The shift position is determined by the discrete logarithm of m base 10 modulo p, reflecting the multiplicative order in the cyclic group generated by 10 modulo p. A longer example is \frac{1}{17} = 0.\overline{0588235294117647}, featuring a 16-digit repetend that rotates under multiplication by 1 through 16. For instance, \frac{2}{17} = 0.\overline{1176470588235294} and \frac{16}{17} = 0.\overline{9411764705882352}, both preserving the digit sequence through cyclic permutation. This cyclic behavior enables efficient verification of expansions for such multiples, as one can confirm correctness by checking the rotation against the base repetend rather than recomputing via long division, and it aids in generating fractions' decimals for educational or computational purposes.

Reciprocals Not Coprime to 10

When the denominator n of a reciprocal $1/n shares prime factors with 10 (i.e., \gcd(n, 10) > 1), the decimal expansion either terminates or consists of a non-repeating followed by a repeating sequence, depending on whether n has prime factors other than 2 and 5. If n is of the form $2^a 5^b with a, b \geq 0, the expansion terminates after \max(a, b) decimal places, as the denominator divides some power of 10. For instance, $1/4 = 1/2^2 = 0.25 (two places), and $1/5 = 0.2 (one place). If n = 2^a 5^b m where m > 1 is coprime to 10, the expansion has a non-repeating of \max(a, b), followed by a repeating part determined by the factors in m. The arises because multiplying the numerator by $10^{\max(a,b)} clears the factors of 2 and 5, leaving by m to produce the repeating after that point. For example, $1/12 = 1/(2^2 \cdot 3) = 0.08\overline{3} (prefix "08" of 2), $1/15 = 1/(3 \cdot 5) = 0.0\overline{6} ( "0" of 1), and $1/20 = 1/(2^2 \cdot 5) = 0.05 (terminating after 2 places). To compute such expansions, first factor out the powers of 2 and 5 from n to isolate the coprime remainder m, then determine the repeating decimal for $1/m (which is purely repeating, unlike the mixed form here) and scale it by the appropriate power of $1/10 corresponding to \max(a, b).

Generalizations

Properties in Other Bases

In an integer base b \geq 2, the positional expansion of a rational number r/s in lowest terms, where $0 < r < s, is terminating if and only if every prime factor of s divides b, meaning s divides some power b^k. Otherwise, the expansion is eventually periodic, with a non-repeating prefix whose length equals the maximum exponent of primes dividing b in the factorization of s, followed by a repeating cycle whose minimal period is the multiplicative order of b modulo s', where s' is the largest divisor of s coprime to b. If \gcd(b, s) = 1, then s' = s and the expansion is purely periodic from the first fractional digit, with period equal to the order of b modulo s. For example, in base b = 2, the fraction $1/3 has \gcd(2, 3) = 1, so its expansion is purely periodic with period equal to the order of 2 modulo 3, which is 2 since $2^1 \equiv 2 \pmod{3} and $2^2 \equiv 1 \pmod{3}; thus, $1/3 = 0.\overline{01}_2. In base b = 3, the fraction $1/2 also satisfies \gcd(3, 2) = 1, yielding a purely periodic expansion with period equal to the order of 3 modulo 2, which is 1 since $3 \equiv 1 \pmod{2}; hence, $1/2 = 0.\overline{1}_3. For a mixed case, consider $1/6 in base b = 10: here s = 6 = 2 \cdot 3, s' = 3, and the order of 10 modulo 3 is 1 (since $10 \equiv 1 \pmod{3}), producing a non-repeating prefix of length 1 (from the factor of 2) followed by a repeating digit: $1/6 = 0.1\overline{6}_{10}. The cyclic properties observed in base-10 repeating decimals extend to other bases. For a prime denominator p coprime to b, the expansion of $1/p is purely periodic with period dividing p-1, and it achieves a full reptend of length exactly p-1 if the order of b modulo p equals p-1, meaning b is a primitive root modulo p. Such full reptends generate cyclic numbers analogous to 142857 for $1/7 in base 10, but now in bases coprime to p. A key difference from base-10 expansions arises in the criteria for terminating representations: in base b, termination depends solely on whether the denominator's primes divide b, without the specific asymmetry between 2 and 5 that occurs because 10 factors as $2 \times 5. For instance, in base b = 6 = 2 \times 3, fractions with denominators powers of 2 or 3 terminate, while those involving other primes repeat, unifying the treatment of base factors.

Algorithm for Arbitrary Bases

The algorithm for computing the repeating expansion of a fraction \frac{p}{q} (with $0 < p < q and \gcd(p, q) = 1) in an arbitrary base b > 1 adapts the classical long division process to generate digits sequentially. Begin with the initial remainder r_0 = p. For each subsequent digit position k = 1, 2, \dots, compute r_{k-1} \times b = d_k \times q + r_k, where d_k (the k-th digit) is the unique integer satisfying $0 \leq d_k < b and $0 \leq r_k < q. The digit d_k = \left\lfloor \frac{r_{k-1} \times b}{q} \right\rfloor, and the new remainder is r_k = (r_{k-1} \times b) \mod q. This process continues indefinitely unless r_k = 0, in which case the expansion terminates. To detect repeating cycles, maintain a record of all seen remainders and their corresponding starting positions. A repetition occurs when a remainder r_k matches a previous remainder r_j (with j < k); the cycle then begins at position j+1 and has length k - j. If the denominator q shares prime factors with b, the expansion may have a non-repeating prefix (preperiod) followed by a repeating part. The preperiod length is the maximum exponent of the primes dividing b that also divide q, after which the remainders enter the coprime portion and begin cycling. The following pseudocode outlines the process for the fractional expansion of \frac{1}{q} in base b, assuming \gcd(1, q) = 1:
function repeating_expansion(b, q):
    remainders = {}  # map remainder to position
    digits = []
    remainder = 1
    position = 0
    while remainder != 0 and remainder not in remainders:
        remainders[remainder] = position
        remainder *= b
        digit = remainder // q
        digits.append(digit)
        remainder %= q
        position += 1
    if remainder == 0:
        return "0." + "".join(map(str, digits)) + " (terminating)"
    else:
        start = remainders[remainder]
        non_repeating = "".join(map(str, digits[:start]))
        repeating = "".join(map(str, digits[start:]))
        return "0." + non_repeating + "\overline{" + repeating + "}_" + str(b)
This implementation handles both terminating and repeating cases, with subscripts indicating the for digits greater than 9 (though examples below use small bases). For a terminating example, consider \frac{1}{2} in 4 (where 2 divides 4). Starting with remainder 1: $1 \times 4 = 4, $4 / 2 = 2 (digit 2), remainder $4 \mod 2 = 0. The expansion is $0.2_4, which equals $2/4 = 1/2 in . For a purely repeating example, \frac{1}{2} in base (coprime): remainder , $1 \times 3 = 3, $3 / 2 = 1 ( 1), remainder 1. The remainder repeats immediately, yielding $0.\overline{1}_3 = \frac{1}{3-1} = \frac{1}{2}. For a mixed case, consider \frac{1}{10} in base 6 (10 = 2 × 5, sharing factor 2 with 6 = 2 × ). Remainder 1, $1 \times 6 = 6, $6 / 10 = 0 ( 0), remainder 6. Next, $6 \times 6 = [36](/page/36), $36 / 10 = 3 ( 3), remainder 6. The remainder repeats, so the expansion is $0.0\overline{3}_6, with preperiod "0" and cycle "3". This equals $0/6 + 3/6^2 / (1 - 1/6) = 3/[36](/page/36) \times 6/5 = 1/10. A longer repeating example is \frac{1}{7} in base 3 (coprime). The remainders cycle through 1 → 3 → 2 → 6 → 4 → 5 → 1 after six steps, producing digits 0,1,0,2,1,2. Thus, $0.\overline{010212}_3 = \frac{0 \cdot 3^5 + 1 \cdot 3^4 + 0 \cdot 3^3 + 2 \cdot 3^2 + 1 \cdot 3 + 2}{3^6 - 1} = \frac{104_{10}}{728_{10}} = \frac{1}{7}.

References

  1. [1]
    Terminating or Repeating? – Mathematics for Elementary Teachers
    Definition. The period of a repeating decimal is the smallest number of digits that repeat. For example, we saw that. The repeating part is just the single ...
  2. [2]
    [PDF] 1.3 The Real Numbers.
    Definition: A repeating decimal is any decimal of the form: q.d1d2 ··· dkdk+1 ··· dndk+1 ··· dndk+1 ··· dn ··· for some pair of natural numbers k<n. We ...
  3. [3]
    [PDF] 9. Mathematics in the sixteenth century - UCR Math Department
    Decimal expansions. The end of the 16th century also saw the adoption of ... Decimal Arithmetike) by Simon Stevin. (1548 – 1620) that the use of decimal ...
  4. [4]
    [PDF] A THEOREM ON REPEATING DECIMALS - UNL Digital Commons
    It is well known that a real number is rational if and only if its decimal ex- pansion is a repeating decimal. For example, 2/7 =. 285714285714 . . . .Missing: definition | Show results with:definition
  5. [5]
    Repeating Decimal -- from Wolfram MathWorld
    Repeating decimal notation was implemented in versions of the Wolfram Language prior to 6 as PeriodicForm[RealDigits[r]] after loading the add-on package ...
  6. [6]
    Earliest Uses of Grouping Symbols - MacTutor History of Mathematics
    Vinculum above. According to Cajori, the first use of the vinculum above the parts affected was by Frans van Schooten (c. 1615-1660), who "in editing Viete ...
  7. [7]
    [PDF] A History of Mathematical Notations, 2 Vols - Monoskop
    Cajori, Florian, 1859-1930. A history of mathematical notations / by Florian Cajori. p. cm. Originally published: Chicago : Open Court Pub. Co., 1928-. 1929 ...
  8. [8]
    [PDF] The Role of Long Division in the K-12 Curriculum - CSUN
    The long division algorithm is the essential tool in establishing that any rational number has a repeating block of digits in its decimal representation. The ...
  9. [9]
    Terminating or Repeating? – Mathematics for Elementary Teachers
    Definition. The period of a repeating decimal is the smallest number of digits that repeat. The repeating part is just the single digit 3, so the period of ...
  10. [10]
    [PDF] Decimal Expansion: An Address System for All Numbers
    Long division is needed to show that a rational number is represented by a repeating decimal. Students in small groups will find decimals with a periodically ...
  11. [11]
    Representing Rational Numbers with Decimals | CK-12 Foundation
    A terminating decimal is a decimal that contains a finite number of digits. Non-terminating decimals can be broken down into two subsets: repeating decimals and ...
  12. [12]
    [PDF] Decimal Form of Rational Numbers
    To learn to rewrite terminating decimals in fraction form fi. To learn to rewrite repeating decimals in fraction form. Activity 1: Converting fractions to ...
  13. [13]
    Converting an Infinite Decimal Expansion to a Rational Number
    To convert, write the first few terms, relate them using sigma notation, use a geometric series, and then apply the sum of an infinite series formula.<|control11|><|separator|>
  14. [14]
    Tutorial 3: Sets of Numbers - West Texas A&M University
    Jun 10, 2011 · In other words, an irrational number is a number that can not be written as one integer over another. It is a non-repeating, non-terminating ...
  15. [15]
  16. [16]
    [PDF] Dirichlet's Pigeonhole Principle
    If none of the remainders is zero, then the sequence of remainders continues forever, and by the Pigeonhole. Principle, some remainder must repeat, that is ...
  17. [17]
    RA Decimal representation of the reals
    The only numbers that have nonunique representations are ones that end in an infinite sequence of s or an infinite sequence of s, because the only ...
  18. [18]
    [PDF] Rational Numbers & Periodic Decimal Expansions
    Assertion: Each rational number has a periodic decimal expansion, and every number with a periodic decimal expansion is a rational number. Proof: This proof ...
  19. [19]
    Decimal expansions - Ximera - The Ohio State University
    An eventually periodic real number. is written. This is a formalized definition of a repeating decimal. (a) A decimal representation of is , so is eventually ...
  20. [20]
    [PDF] PERIODIC DECIMAL FRACTIONS A Thesis Presented to the Faculty ...
    A purely per iodic decimal fraction begins its period or repeating cycle of digits with the digit directly to the right of the decimal point. The periodic or ...
  21. [21]
    [PDF] Does 0.999… Really Equal 1?
    This article confronts the issue of why secondary and post- secondary students resist accepting the equality of 0.999… and 1,.Missing: dual | Show results with:dual
  22. [22]
    Decimal Expansion -- from Wolfram MathWorld
    The decimal expansion of a number can be found in the Wolfram Language using the command RealDigits[n], or equivalently, RealDigits[n, 10].
  23. [23]
    Decimal Period -- from Wolfram MathWorld
    The decimal period of a repeating decimal is the number of digits that repeat. For example, 1/3=0.3^_ has decimal period one, 1/11=0.09^_ has decimal period ...
  24. [24]
    Multiplicative Order -- from Wolfram MathWorld
    10^6=1 (mod 7). (1). The multiplicative order of 10 mod an integer n relatively prime to 10 gives the period of the decimal expansion of the reciprocal of n ...
  25. [25]
  26. [26]
    Cyclic Number -- from Wolfram MathWorld
    ### Summary of Cyclic Numbers from Wolfram MathWorld
  27. [27]
    What is 1/9 as a Decimal? (with Solution) - Inch Calculator
    1/9 = 1 ÷ 9 = 0.1111… To use the division method to express 1/9 as a decimal, divide the fraction's numerator (1) by the denominator (9), which is equal to 0. ...
  28. [28]
    Fraction 1/21 as a decimal - Calculatio
    To convert 1/21 to decimal you need simply divide numerator 1 by denominator 21. The result of the division is: 1 ÷ 21 = 0.047619047619.
  29. [29]
    Fraction 1/77 as a decimal - Calculatio
    To convert 1/77 to decimal you need simply divide numerator 1 by denominator 77. The result of the division is: 1 ÷ 77 = 0.012987012987... Since the remainder ...
  30. [30]
    Fraction 1/33 as a decimal - Calculatio
    To convert 1/33 to decimal you need simply divide numerator 1 by denominator 33. The result of the division is: 1 ÷ 33 = 0.03030303030303.
  31. [31]
  32. [32]
    Repeating Decimal to Fraction - Steps of Conversion, Tricks, Examples
    This is the method to convert a repeating decimal to a fraction. Explore math program. Download FREE Study Materials. Repeating Decimal to Fraction Worksheets.<|control11|><|separator|>
  33. [33]
    How to convert recurring decimals - GCSE Maths Revision - BBC
    To convert a recurring decimal, use a variable, multiply by a power of ten based on the repeating digits, subtract the original decimal, and then write the ...
  34. [34]
    Writing repeating decimals as fractions review - Khan Academy
    To convert a decimal to a fraction, we write the decimal number as a numerator, and we write its place value as the denominator. Example 1: 0.07 ‍.
  35. [35]
    Converting Repeating Decimals to Fractions - Illustrative Math Tasks
    Repeating decimals can be converted to fractions using fractions like 1/9, 1/99, 1/999, etc. For example, 0.137137... is equal to 137/999.
  36. [36]
    [PDF] Infinite Series
    Every repeating decimal adds up (through the geometric series) to a fraction. To get 3.333..., just multiply by 3.Missing: representation | Show results with:representation
  37. [37]
    [PDF] 2. INFINITE SERIES
    The geometric series formula may also be used to convert repeating decimals into frac- tions, as we show next. Example 5. Express the number 4.342342342 ...
  38. [38]
    [PDF] 8.3 ARITHMETIC AND GEOMETRIC SEQUENCES
    Nov 30, 1995 · The following example illustrates how we can use an infinite geometric series to express a repeating decimal as a fraction of integers. cEXAMPLE ...<|control11|><|separator|>
  39. [39]
    The Prime Glossary: period of a decimal expansion
    ### Summary of Period of a Decimal Expansion
  40. [40]
    Full Reptend Prime -- from Wolfram MathWorld
    A prime p for which 1/p has a maximal period decimal expansion of p-1 digits. Full reptend primes are sometimes also called long primes.
  41. [41]
    Recurring decimals and 1/7 - The Aperiodical
    Jan 9, 2023 · The recurring cycle for 1 7 , which is 142857 , has a length of 6 digits – and when the length of the cycle produced from a fraction is one ...
  42. [42]
    [PDF] Contents 2 Modular Arithmetic in Z - Evan Dummit
    Hence the p − 1 cyclic shifts of the repeating decimal expansion of 1/p yield the repeating decimal expansions for k/p for 1 ≤ k ≤ p − 1 as claimed ...
  43. [43]
    Cyclic fractions - Applied Mathematics Consulting
    Nov 12, 2014 · The digits in the decimal expansion of multiples of 1/7 are all rotations of the same digits: 1/7 = 0.142857142857... 2/7 = 0.285714285714...
  44. [44]
    Repeating Decimals and Cyclic Numbers
    At some point (preferably before high school), a Math teacher should have explained the convention of placing a bar over repeating decimal digits, or ...
  45. [45]
    [PDF] orders of units in modular arithmetic - Keith Conrad
    It is believed that 10 mod p has order p − 1 for infinitely many primes p, or equivalently. 1/p has decimal period length p − 1 for infinitely many primes p.
  46. [46]
    [PDF] decimal data
    The first two tables below give the decimal expansion of 1/b for 2 ≤ b ≤ 90. ... 1/12 .083. 1/13 .076923. 1/14 .0714528. 1/15 .06. 1/16 .0625. 1/17.
  47. [47]
    [PDF] Base b Expansions of Rational Numbers - Trinity University
    The base b expansion of r/s is purely periodic with minimal period m if and only if (b,s)=1 and m is the multiplicative order of b modulo s. Example 1. Verify ...
  48. [48]
    [PDF] 7 8 34 17 8 34 17 : : : : : 0 0 0 0 0 0 : : : : : 4 2 1 4 2 1 : : : : : 1. 1. 0.
    We'll look first at the case where the fraction is 1/p and p is a prime number. • The expansion of 1/p in any base B has a period of repetition dividing p − 1.<|control11|><|separator|>
  49. [49]
    [PDF] Periodic Properties of Expansions for Fractions into any Base
    interesting properties of repeating decimals in arbitrary bases. An Excel spreadsheet utilizes the Spigot algorithm to compute binary digits of π. A Java ...