Repeating Decimals
   HOME

TheInfoList



OR:

A repeating decimal or recurring decimal is
decimal representation A decimal representation of a non-negative real number is its expression as a sequence of symbols consisting of decimal digits traditionally written with a single separator: r = b_k b_\ldots b_0.a_1a_2\ldots Here is the decimal separator, is ...
of a number whose digits are periodic (repeating its values at regular intervals) and the
infinitely Infinity is that which is boundless, endless, or larger than any natural number. It is often denoted by the infinity symbol . Since the time of the ancient Greeks, the philosophical nature of infinity was the subject of many discussions amo ...
repeated portion is not
zero 0 (zero) is a number representing an empty quantity. In place-value notation Positional notation (or place-value notation, or positional numeral system) usually denotes the extension to any base of the Hindu–Arabic numeral system (or ...
. It can be shown that a number is
rational Rationality is the quality of being guided by or based on reasons. In this regard, a person acts rationally if they have a good reason for what they do or a belief is rational if it is based on strong evidence. This quality can apply to an abili ...
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 A decimal separator is a symbol used to separate the integer part from the fractional part of a number written in decimal form (e.g., "." in 12.45). Different countries officially designate different symbols for use as the separator. The choi ...
, 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 The decimal numeral system (also called the base-ten positional numeral system and denary or decanary) is the standard system for denoting integer and non-integer numbers. It is the extension to non-integer numbers of the Hindu–Arabic numeral ...
, a fraction whose denominator is a
power Power most often refers to: * Power (physics), meaning "rate of doing work" ** Engine power, the power put out by an engine ** Electric power * Power (social and political), the ability to influence people or events ** Abusive power Power may a ...
of 10 (e.g. ); it may also be written as a
ratio In mathematics, a ratio shows how many times one number contains another. For example, if there are eight oranges and six lemons in a bowl of fruit, then the ratio of oranges to lemons is eight to six (that is, 8:6, which is equivalent to the ...
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. Two examples of this are and . (This type of repeating decimal can be obtained by long division if one uses a modified form of the usual
division algorithm A division algorithm is an algorithm which, given two integers N and D, computes their quotient and/or remainder, the result of Euclidean division. Some are applied by hand, while others are employed by digital circuit designs and software. Divis ...
.) Any number that cannot be expressed as a
ratio In mathematics, a ratio shows how many times one number contains another. For example, if there are eight oranges and six lemons in a bowl of fruit, then the ratio of oranges to lemons is eight to six (that is, 8:6, which is equivalent to the ...
of two
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign (−1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
s is said to be
irrational Irrationality is cognition, thinking, talking, or acting without inclusion of rationality. It is more specifically described as an action or opinion given through inadequate use of reason, or through emotional distress or cognitive deficiency. T ...
. Their decimal representation neither terminates nor infinitely repeats, but extends forever without repetition (see ). Examples of such irrational numbers are and .


Background


Notation

There are several notational conventions for representing repeating decimals. None of them are accepted universally. *In the
United States The United States of America (U.S.A. or USA), commonly known as the United States (U.S. or US) or America, is a country primarily located in North America. It consists of 50 states, a federal district, five major unincorporated territorie ...
,
Canada Canada is a country in North America. Its ten provinces and three territories extend from the Atlantic Ocean to the Pacific Ocean and northward into the Arctic Ocean, covering over , making it the world's second-largest country by tot ...
,
India India, officially the Republic of India (Hindi: ), is a country in South Asia. It is the seventh-largest country by area, the second-most populous country, and the most populous democracy in the world. Bounded by the Indian Ocean on the so ...
,
France France (), officially the French Republic ( ), is a country primarily located in Western Europe. It also comprises of Overseas France, overseas regions and territories in the Americas and the Atlantic Ocean, Atlantic, Pacific Ocean, Pac ...
,
Germany Germany,, officially the Federal Republic of Germany, is a country in Central Europe. It is the second most populous country in Europe after Russia, and the most populous member state of the European Union. Germany is situated betwe ...
,
Italy Italy ( it, Italia ), officially the Italian Republic, ) or the Republic of Italy, is a country in Southern Europe. It is located in the middle of the Mediterranean Sea, and its territory largely coincides with the homonymous geographical re ...
,
Switzerland ). Swiss law does not designate a ''capital'' as such, but the federal parliament and government are installed in Bern, while other federal institutions, such as the federal courts, are in other cities (Bellinzona, Lausanne, Luzern, Neuchâtel ...
, the
Czech Republic The Czech Republic, or simply Czechia, is a landlocked country in Central Europe. Historically known as Bohemia, it is bordered by Austria to the south, Germany to the west, Poland to the northeast, and Slovakia to the southeast. The ...
,
Slovakia Slovakia (; sk, Slovensko ), officially the Slovak Republic ( sk, Slovenská republika, links=no ), is a landlocked country in Central Europe. It is bordered by Poland to the north, Ukraine to the east, Hungary to the south, Austria to the s ...
, and
Turkey Turkey ( tr, Türkiye ), officially the Republic of Türkiye ( tr, Türkiye Cumhuriyeti, links=no ), is a list of transcontinental countries, transcontinental country located mainly on the Anatolia, Anatolian Peninsula in Western Asia, with ...
the convention is to draw a horizontal line (a vinculum) above the repetend. (See examples in table below, column Vinculum.) *In the
United Kingdom The United Kingdom of Great Britain and Northern Ireland, commonly known as the United Kingdom (UK) or Britain, is a country in Europe, off the north-western coast of the continental mainland. It comprises England, Scotland, Wales and North ...
,
New Zealand New Zealand ( mi, Aotearoa ) is an island country in the southwestern Pacific Ocean. It consists of two main landmasses—the North Island () and the South Island ()—and over 700 smaller islands. It is the sixth-largest island count ...
,
Australia Australia, officially the Commonwealth of Australia, is a Sovereign state, sovereign country comprising the mainland of the Australia (continent), Australian continent, the island of Tasmania, and numerous List of islands of Australia, sma ...
,
India India, officially the Republic of India (Hindi: ), is a country in South Asia. It is the seventh-largest country by area, the second-most populous country, and the most populous democracy in the world. Bounded by the Indian Ocean on the so ...
,
South Korea South Korea, officially the Republic of Korea (ROK), is a country in East Asia, constituting the southern part of the Korea, Korean Peninsula and sharing a Korean Demilitarized Zone, land border with North Korea. Its western border is formed ...
, and
mainland China "Mainland China" is a geopolitical term defined as the territory governed by the People's Republic of China (including islands like Hainan or Chongming), excluding dependent territories of the PRC, and other territories within Greater 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 Europe is a large peninsula conventionally considered a continent in its own right because of its great physical size and the weight of its history and traditions. Europe is also considered a Continent#Subcontinents, subcontinent of Eurasia ...
,
Vietnam Vietnam or Viet Nam ( vi, Việt Nam, ), officially the Socialist Republic of Vietnam,., group="n" is a country in Southeast Asia, at the eastern edge of mainland Southeast Asia, with an area of and population of 96 million, making i ...
and
Russia Russia (, , ), or the Russian Federation, is a List of transcontinental countries, transcontinental country spanning Eastern Europe and North Asia, Northern Asia. It is the List of countries and dependencies by area, largest country in the ...
, the convention is to enclose the repetend in
parentheses A bracket is either of two tall fore- or back-facing punctuation marks commonly used to isolate a segment of text or data from its surroundings. Typically deployed in symmetric pairs, an individual bracket may be identified as a 'left' or 'r ...
. (See examples in table below, column Parentheses.) This can cause confusion with the notation for
standard uncertainty Uncertainty refers to epistemic situations involving imperfect or unknown information. It applies to predictions of future events, to physical measurements that are already made, or to the unknown. Uncertainty arises in partially observable or ...
. *In
Spain , image_flag = Bandera de España.svg , image_coat = Escudo de España (mazonado).svg , national_motto = ''Plus ultra'' (Latin)(English: "Further Beyond") , national_anthem = (English: "Royal March") , i ...
and some
Latin America Latin America or * french: Amérique Latine, link=no * ht, Amerik Latin, link=no * pt, América Latina, link=no, name=a, sometimes referred to as LatAm is a large cultural region in the Americas where Romance languages — languages derived f ...
n 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 The ellipsis (, also known informally as dot dot dot) is a series of dots that indicates an intentional omission of a word, sentence, or whole section from a text without altering its original meaning. The plural is ellipses. The term origin ...
(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 number In mathematics, the irrational numbers (from in- prefix assimilated to ir- (negative prefix, privative) + rational) are all the real numbers that are not rational numbers. That is, irrational numbers cannot be expressed as the ratio of two integ ...
s; π, for example, can be represented as 3.14159.... 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 In mathematics, a rational number is a number that can be expressed as the quotient or fraction of two integers, a numerator and a non-zero denominator . For example, is a rational number, as is every integer (e.g. ). The set of all ration ...
represented as a fraction into decimal form, one may use
long division In arithmetic, long division is a standard division algorithm suitable for dividing multi-digit Hindu-Arabic numerals (Positional notation) that is simple enough to perform by hand. It breaks down a division problem into a series of easier steps. ...
. 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 In mathematics, a linear equation is an equation that may be put in the form a_1x_1+\ldots+a_nx_n+b=0, where x_1,\ldots,x_n are the variables (or unknowns), and b,a_1,\ldots,a_n are the coefficients, which are often real numbers. The coefficien ...
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 Below may refer to: *Earth *Ground (disambiguation) *Soil *Floor *Bottom (disambiguation) Bottom may refer to: Anatomy and sex * Bottom (BDSM), the partner in a BDSM who takes the passive, receiving, or obedient role, to that of the top or ...
.


Table of values

Thereby ''fraction'' is the
unit fraction A unit fraction is a rational number written as a fraction where the numerator is one and the denominator is a positive integer. A unit fraction is therefore the reciprocal of a positive integer, 1/''n''. Examples are 1/1, 1/2, 1/3, 1/4, 1/5, et ...
and ''ℓ''10 is the length of the (decimal) repetend. The lengths ''ℓ''10(''n'') of the decimal repetends 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, ... . For comparison, the lengths ''ℓ''2(''n'') of the
binary Binary may refer to: Science and technology Mathematics * Binary number, a representation of numbers using only two digits (0 and 1) * Binary function, a function that takes two arguments * Binary operation, a mathematical operation that t ...
repetends of the fractions , ''n'' = 1, 2, 3, ..., are: :0, 0, 2, 0, 4, 2, 3, 0, 6, 4, 10, 2, 12, 3, 4, 0, 8, 6, 18, 4, 6, 10, 11, 2, 20, 12, 18, 3, 28, 4, 5, 0, 10, 8, 12, 6, 36, 18, 12, 4, 20, 6, 14, 10, 12, 11, ... (= 'n'' if ''n'' not a power of 2 else =0). The decimal 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, ... . The decimal repetend lengths of , ''p'' = 2, 3, 5, ... (''n''th 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, ... . The least primes ''p'' for which has decimal 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, ... . 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, ... .


Fractions with prime denominators

A fraction
in lowest terms An irreducible fraction (or fraction in lowest terms, simplest form or reduced fraction) is a fraction (mathematics), fraction in which the numerator and denominator are integers that have no other common divisors than 1 (and −1, when negative nu ...
with a
prime A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only ways ...
denominator other than 2 or 5 (i.e.
coprime In mathematics, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equivale ...
to 10) always produces a repeating decimal. The length of the repetend (period of the repeating decimal segment) of is equal to the
order Order, ORDER or Orders may refer to: * Categorization, the process in which ideas and objects are recognized, differentiated, and understood * Heterarchy, a system of organization wherein the elements have the potential to be ranked a number of d ...
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 Fermat's little theorem states that if ''p'' is a prime number, then for any integer ''a'', the number a^p - a is an integer multiple of ''p''. In the notation of modular arithmetic, this is expressed as : a^p \equiv a \pmod p. For example, if = ...
, which states that . The base-10
digital root The digital root (also repeated digital sum) of a natural number in a given radix is the (single digit) value obtained by an iterative process of summing digits, on each iteration using the result from the previous iteration to compute a digit su ...
of the 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 The list can go on to include the fractions , , , , , , , , etc. . 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 The number 142,857 is a Kaprekar number. 142857, the six repeating digits of (0.), is the best-known cyclic number in base 10. If it is multiplied by 2, 3, 4, 5, or 6, the answer will be a cyclic permutation of itself, and will correspond t ...
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 In mathematics and computing, the method of complements is a technique to encode a symmetric range of positive and negative integers in a way that they can use the same algorithm (hardware) for addition throughout the whole range. For a given num ...
form. For example starts '142' and is followed by '857' while (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, times). They are: :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,... . A prime is a proper prime if and only if it is a
full reptend prime In number theory, a full reptend prime, full repetend prime, proper primeDickson, Leonard E., 1952, ''History of the Theory of Numbers, Volume 1'', Chelsea Public. Co. or long prime in base ''b'' is an odd prime number ''p'' such that the Fermat q ...
and
congruent Congruence may refer to: Mathematics * Congruence (geometry), being the same size and shape * Congruence or congruence relation, in abstract algebra, an equivalence relation on an algebraic structure that is compatible with the structure * In mod ...
to 1 mod 10. If a prime ''p'' is both
full reptend prime In number theory, a full reptend prime, full repetend prime, proper primeDickson, Leonard E., 1952, ''History of the Theory of Numbers, Volume 1'', Chelsea Public. Co. or long prime in base ''b'' is an odd prime number ''p'' such that the Fermat q ...
and
safe prime In number theory, a prime number ''p'' is a if 2''p'' + 1 is also prime. The number 2''p'' + 1 associated with a Sophie Germain prime is called a . For example, 11 is a Sophie Germain prime and 2 × 11 +  ...
, 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,... .


Other reciprocals of primes

Some reciprocals of primes that do not generate cyclic numbers are: * = 0., which has a period (repetend length) 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. 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 :\frac= 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 ''L''(''n'') of the decimal repetend of divides ''φ''(''n''), where ''φ'' is the
totient function In number theory, Euler's totient function counts the positive integers up to a given integer that are relatively prime to . It is written using the Greek letter phi as \varphi(n) or \phi(n), and may also be called Euler's phi function. In ot ...
. 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 In logic and related fields such as mathematics and philosophy, "if and only if" (shortened as "iff") is a biconditional logical connective between statements, where either both statements are true or both are false. The connective is bicondi ...
''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.. The period (repetend length) ''L''(49) must be a factor of ''λ''(49) = 42, where ''λ''(''n'') is known as the
Carmichael function In number theory, a branch of mathematics, the Carmichael function of a positive integer is the smallest positive integer such that :a^m \equiv 1 \pmod holds for every integer coprime to . In algebraic terms, is the exponent of the multip ...
. This follows from
Carmichael's theorem In number theory, Carmichael's theorem, named after the American mathematician R. D. Carmichael, states that, for any nondegenerate Lucas sequence of the first kind ''U'n''(''P'', ''Q'') with relatively prime parameters ''P'',  ...
which states that if ''n'' is a positive integer then ''λ''(''n'') is the smallest integer ''m'' such that :a^m \equiv 1 \pmod n for every integer ''a'' that is
coprime In mathematics, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equivale ...
to ''n''. The period of is usually ''pT''''p'', where ''T''''p'' 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 ''p''2 divides 10''p''−1−1. These three primes are 3, 487, and 56598313 . Similarly, the period of is usually ''p''''k''–1''T''''p'' 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 In arithmetic and number theory, the least common multiple, lowest common multiple, or smallest common multiple of two integers ''a'' and ''b'', usually denoted by lcm(''a'', ''b''), is the smallest positive integer that is divisible by bot ...
. The period ''T'' of is a factor of ''λ''(''pq'') and it happens to be 48 in this case: : = 0.. The period ''T'' of is LCM(''T''''p'', ''T''''q''), where ''T''''p'' is the period of and ''T''''q'' is the period of . If ''p'', ''q'', ''r'', etc. are primes other than 2 or 5, and ''k'', ''ℓ'', ''m'', etc. are positive integers, then :\frac is a repeating decimal with a period of :\operatorname(T_, T_, T_, \ldots) where ''Tpk'', ''Tq'', ''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: :\frac\, , where ''a'' and ''b'' are not both zero. This fraction can also be expressed as: :\frac\, , if ''a'' > ''b'', or as :\frac\, , if ''b'' > ''a'', or as :\frac\, , if ''a'' = ''b''. The decimal has: *An initial transient of max(''a'', ''b'') 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.03: *''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 produces it. For example: : 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: :\begin x &= 0.000000100000010000001\ldots \\ 10^7x &= 1.000000100000010000001\ldots \\ \left(10^7-1\right)x=9999999x &= 1 \\ x &= \frac = \frac \end So this particular repeating decimal corresponds to the fraction , 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: : \begin 7.48181818\ldots & = 7.3 + 0.18181818\ldots \\ pt& = \frac+\frac = \frac + \frac = \frac + \frac \\
2pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
& = \frac = \frac \end 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: :\begin x &= 0.\overline \\ 10^n x &= a_1 a_2 \cdots a_n.\overline \\ \left(10^n - 1\right)x = 99 \cdots 99x &= a_1 a_2 \cdots a_n \\ x &= \frac = \frac \end 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, *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 Period may refer to: Common uses * Era, a length or span of time * Full stop (or period), a punctuation mark Arts, entertainment, and media * Period (music), a concept in musical composition * Periodic sentence (or rhetorical period), a concept ...
''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 (10''n'' − 1)10''k''. Conversely the period of the repeating decimal of a fraction will be (at most) the smallest number ''n'' such that 10''n'' − 1 is divisible by ''d''. For example, the fraction has ''d'' = 7, and the smallest ''k'' that makes 10''k'' − 1 divisible by 7 is ''k'' = 6, because 999999 = 7 × 142857. The period of the fraction is therefore 6.


In compressed form

The following picture suggests kind of compression of the above shortcut. Thereby \mathbf represents the digits of the integer part of the decimal number (to the left of the decimal point), \mathbf makes up the string of digits of the preperiod and \#\mathbf its length, and \mathbf being the string of repeated digits (the period) with length \#\mathbf which is nonzero. In the generated fraction, the digit 9 will be repeated \#\mathbf times, and the digit 0 will be repeated \#\mathbf times. Note that in the absence of an ''integer'' part in the decimal, \mathbf 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: \begin 3.254444... &=3.25\overline &= \begin \mathbf=3&\mathbf=25&\mathbf=4\\ &\#\mathbf=2&\#\mathbf=1 \end &=\frac&=\frac \\ \\0.512512... &=0.\overline &= \begin \mathbf=0&\mathbf=\emptyset&\mathbf=512\\ &\#\mathbf=0&\#\mathbf=3 \end &=\frac&=\frac \\ \\1.09191... &=1.0\overline &= \begin \mathbf=1&\mathbf=0&\mathbf=91\\ &\#\mathbf=1&\#\mathbf=2 \end &=\frac&=\frac \\ \\1.333... &=1.\overline &= \begin \mathbf=1&\mathbf=\emptyset&\mathbf=3\\ &\#\mathbf=0&\#\mathbf=1 \end &=\frac&=\frac&=\frac \\ \\0.3789789... &=0.3\overline &= \begin \mathbf=0&\mathbf=3&\mathbf=789\\ &\#\mathbf=1&\#\mathbf=3 \end &=\frac&=\frac&=\frac \end The symbol \emptyset in the examples above denotes the absence of digits of part \mathbf in the decimal, and therefore \#\mathbf=0 and a corresponding absence in the generated fraction.


Repeating decimals as infinite series

A repeating decimal can also be expressed as an
infinite series In mathematics, a series is, roughly speaking, a description of the operation of adding infinitely many quantities, one after the other, to a given starting quantity. The study of series is a major part of calculus and its generalization, math ...
. That is, a repeating decimal can be regarded as the sum of an infinite number of rational numbers. To take the simplest example, :0.\overline = \frac + \frac + \frac + \cdots = \sum_^\infty \frac The above series is a
geometric series In mathematics, a geometric series is the sum of an infinite number of terms that have a constant ratio between successive terms. For example, the series :\frac \,+\, \frac \,+\, \frac \,+\, \frac \,+\, \cdots is geometric, because each succ ...
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. :\frac = \frac = \frac = \frac Similarly, :\begin 0.\overline &= \frac + \frac + \frac + \cdots = \sum_^\infty \frac \\ px\implies &\quad \frac = \frac = \frac = \frac = \frac17 \end


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 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 In mathematics, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equivale ...
to ''k'', equals the period of . *If ''k'' = 2''a''5''b''''n'' where ''n'' > 1 and ''n'' is not divisible by 2 or 5, then the length of the transient of is max(''a'', ''b''), 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 ::\text\left(\frac\right)= \text\left(\frac\right)= \cdots = \text\left(\frac\right) :for some ''m'', but ::\text\left(\frac\right) \ne \text\left(\frac \right), :then for ''c'' ≥ 0 we have ::\text\left(\frac\right) = p^c \cdot \text\left(\frac\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'' = 10''h'' + 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.


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 In a positional numeral system, the radix or base is the number of unique digits, including the digit zero, used to represent numbers. For example, for the decimal/denary system (the most common system in use today) the radix (base number) is t ...
point (the generalization of a
decimal point A decimal separator is a symbol used to separate the integer part from the fractional part of a number written in decimal form (e.g., "." in 12.45). Different countries officially designate different symbols for use as the separator. The choi ...
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 topology and related areas of mathematics, a subset ''A'' of a topological space ''X'' is said to be dense in ''X'' if every point of ''X'' either belongs to ''A'' or else is arbitrarily "close" to a member of ''A'' — for instance, the r ...
in and . *If the
positional numeral system Positional notation (or place-value notation, or positional numeral system) usually denotes the extension to any radix, base of the Hindu–Arabic numeral system (or decimal, decimal system). More generally, a positional system is a numeral syste ...
is a standard one, that is it has base ::b\in\Z\smallsetminus\ :combined with a consecutive set of digits ::D:=\ :with , and , 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 In mathematics, the lexicographic or lexicographical order (also known as lexical order, or dictionary order) is a generalization of the alphabetical order of the dictionaries to sequences of ordered symbols or, more generally, of elements of a ...
of the right-sided infinite strings over the
alphabet An alphabet is a standardized set of basic written graphemes (called letters) that represent the phonemes of certain spoken languages. Not all writing systems represent language in this way; in a syllabary, each character represents a syll ...
into some closed interval of the reals, which maps the strings and with and to the same real number – and there are no other duplicate images. In the decimal system, for example, there is 0. = 1. = 1; in the
balanced ternary Balanced ternary is a ternary numeral system (i.e. base 3 with three digits) that uses a balanced signed-digit representation of the integers in which the digits have the values −1, 0, and 1. This stands in contrast to the standard (unbalance ...
system there is 0. = 1. = . *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 In number theory, given a positive integer ''n'' and an integer ''a'' coprime to ''n'', the multiplicative order of ''a'' modulo ''n'' is the smallest positive integer ''k'' such that a^k\ \equiv\ 1 \pmod n. In other words, the multiplicative order ...
of the residue class which is a divisor of the
Carmichael function In number theory, a branch of mathematics, the Carmichael function of a positive integer is the smallest positive integer such that :a^m \equiv 1 \pmod holds for every integer coprime to . In algebraic terms, is the exponent of the multip ...
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 ::\left(0.\overline\right)_b :represents the fraction ::\frac. *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 The duodecimal system (also known as base 12, dozenal, or, rarely, uncial) is a positional notation numeral system using twelve as its base. The number twelve (that is, the number written as "12" in the decimal numerical system) is instead wri ...
, = 0.6, = 0.4, = 0.3 and = 0.2 all terminate; = 0. repeats with period length 4, in contrast with the equivalent decimal expansion of 0.2; = 0. has period 6 in duodecimal, just as it does in decimal. If is an integer base and is an integer, then :\frac = \frac + \frac + \frac + \frac + \cdots + \frac + \cdots = \frac1b \frac1. For example in duodecimal: : = ( + + + + + + ...)base12 which is 0.base12. 10base12 is 12base10, 102base12 is 144base10, 21base12 is 25base10, A5base12 is 125base10.


Algorithm for positive bases

For a rational (and base ) 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 do occurs = pos; // the position of the place with remainder p bp = b*p; z = floor(bp/q); // index z of digit within: 0 ≤ z ≤ b-1 p = b*p − z*q; // 0 ≤ p < q if p = 0 then L = 0; if not z = 0 then s = s . substring(digits, z, 1) end if return (s); end if s = s . substring(digits, z, 1); // append the character of the digit pos += 1; end while L = pos - occurs // the length of the repetend (being < q) // mark the digits of the repetend by a vinculum: for i from occurs to pos-1 do substring(s, i, 1) = overline(substring(s, i, 1)); end for return (s); end function The first highlighted line calculates the digit . The subsequent line calculates the new remainder of the division
modulo In computing, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another (called the '' modulus'' of the operation). Given two positive numbers and , modulo (often abbreviated as ) is t ...
the denominator . As a consequence of the
floor function In mathematics and computer science, the floor function is the function that takes as input a real number , and gives as output the greatest integer less than or equal to , denoted or . Similarly, the ceiling function maps to the least int ...
floor we have : \frac - 1 \; \; < \; \; z = \left\lfloor \frac \right\rfloor \; \; \le \; \; \frac , thus : b p - q < z q \quad \implies \quad p' := b p - z q < q and : z q \le b p\quad \implies \quad 0 \le b p - z q =: p' \,. Because all these remainders are non-negative integers less than , 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 In computer science, an associative array, map, symbol table, or dictionary is an abstract data type that stores a collection of (key, value) pairs, such that each possible key appears at most once in the collection. In mathematical terms an as ...
occurs. The new digit is formed in the yellow line, where is the only non-constant. The length 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. 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: :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 The diehard tests are a battery of statistical tests for measuring the quality of a random number generator. They were developed by George Marsaglia over several years and first published in 1995 on a CD-ROM of random numbers. Test overview ; Bi ...
.Bellamy, J. "Randomness of D sequences via diehard testing". 2013.


See also

*
Decimal representation A decimal representation of a non-negative real number is its expression as a sequence of symbols consisting of decimal digits traditionally written with a single separator: r = b_k b_\ldots b_0.a_1a_2\ldots Here is the decimal separator, is ...
*
Full reptend prime In number theory, a full reptend prime, full repetend prime, proper primeDickson, Leonard E., 1952, ''History of the Theory of Numbers, Volume 1'', Chelsea Public. Co. or long prime in base ''b'' is an odd prime number ''p'' such that the Fermat q ...
*
Midy's theorem In mathematics, Midy's theorem, named after French mathematician E. Midy, is a statement about the decimal expansion of fractions ''a''/''p'' where ''p'' is a prime and ''a''/''p'' has a repeating decimal expansion with an even period . If the p ...
*
Parasitic number An ''n''-parasitic number (in base 10) is a positive natural number which, when multiplied by ''n'', results in movement of the last digit of its decimal representation to its front. Here ''n'' is itself a single-digit positive natural number. In ...
*
Trailing zero In mathematics, trailing zeros are a sequence of 0 in the decimal representation (or more generally, in any positional representation) of a number, after which no other digits follow. Trailing zeros to the right of a decimal point, as in 12.3400 ...
*
Unique prime The reciprocals of prime numbers have been of interest to mathematicians for various reasons. They do not have a finite sum, as Leonhard Euler proved in 1737. Like all rational numbers, the reciprocals of primes have repeating decimal represen ...
* 0.999..., a repeating decimal equal to one *
Pigeonhole principle In mathematics, the pigeonhole principle states that if items are put into containers, with , then at least one container must contain more than one item. For example, if one has three gloves (and none is ambidextrous/reversible), then there mu ...


References and remarks


External links

*{{MathWorld, title=Repeating Decimal, urlname=RepeatingDecimal Elementary arithmetic Numeral systems de:Rationale Zahl#Dezimalbruchentwicklung