The decimal expansion of a number is its representation in base-10 (i.e., in the decimal system), and is the
base-10 counterpart of a binary expansion. It
consists of decimal digits 0 through 9 whose positions
determine their place values. Each decimal digit
is multiplied by a power of 10, decreasing from left to
right. The decimal point separates the units place,
with place value ,
from the tenths place, with place value
. For example, the number
with decimal expansion 1234.56 is defined as
|
(1)
| |||
|
(2)
|
Expressions written in this form (where negative
are allowed as exemplified above but
usually not considered in elementary education contexts) are said to be in expanded
notation.
Other examples include the decimal expansion of given by 625, of
given by 3.14159..., and of
given by 0.1111.... The decimal expansion of a number
can be found in the Wolfram Language
using the command RealDigits[n],
or equivalently, RealDigits[n,
10].
Every nonzero real number with a terminating decimal expansion also
has a nonterminating decimal expansion whose decimal
digits are eventually all 9s. For example, . Apart from leading zeros,
pairs of this form account for all nonuniqueness of decimal expansions.
The decimal expansion of a number may terminate (in which case it is a terminating decimal, e.g., ), be eventually
periodic (in which case the number is called a repeating decimal, e.g.,
), or continue infinitely without repeating (in which
case the number is called irrational).
The following table summarizes the decimal expansions of the first few unit fractions. As usual, the repeating portion of a decimal expansion is conventionally denoted with a vinculum.
| fraction | decimal expansion | fraction | decimal expansion |
| 1 | 1 | ||
| 0.5 | |||
| 0.25 | |||
| 0.2 | |||
| 0.0625 | |||
| 0.125 | |||
| 0.1 | 0.05 |
If
lies in
and has a terminating decimal expansion, then
|
(3)
| |||
|
(4)
| |||
|
(5)
|
Canceling common factors gives
|
(6)
|
where this is a reduced fraction. A rational number has a terminating decimal expansion iff its reduced denominator
has the form
with nonnegative integers
and
. These are the denominators
of regular unit fractions.
The first few such denominators are 1, 2, 4, 5, 8,
10, 16, 20, 25, 32, 40, 50, ... (OEIS A003592).
Any reduced fraction with positive denominator
not of the
form
has an eventually periodic decimal expansion,
and has a decimal period
independent of
, which is at most
decimal digits long. If
is relatively prime to 10, then the decimal
period
of
is a divisor of
and has at most
decimal digits, where
is the totient function. It turns out that
is the multiplicative
order of 10 (mod
)
(Glaisher 1878, Lehmer 1941). The number of decimal
digits in the repeating portion of the nonterminating decimal expansion of a
rational number is the multiplicative
order of 10 modulo the part of its reduced denominator
that is relatively prime to 10.
When a rational number with
has a nonterminating decimal expansion, the decimal
period begins after
decimal digits and has length
,
where
and
are the smallest integers with
and
satisfying
|
(7)
|
When
(mod 2, 5),
,
and this becomes a purely periodic decimal with
|
(8)
|
As an example, consider .
|
(9)
|
so ,
.
The decimal representation is
. When the denominator
of a reduced fraction
has the form
with
and
, then the decimal period
begins after
decimal digits and its length is the multiplicative
order of 10 modulo
, i.e., the least positive
integer
such that
. If
, the fraction instead has
a terminating decimal expansion with
fractional decimal
digits. If
is prime and
is even, then breaking
the repeating decimal digits into two equal halves
and adding gives all 9s. For example,
, and
. For
with a prime denominator
other than 2 or 5, all cycles
with
have the same length (Conway and Guy 1996).
If
is a prime and 10 is a primitive
root of
,
then the decimal period
of the repeating
decimal
is given by
|
(10)
|
where
is the totient function. Furthermore, the decimal
expansions for
,
with
,
2, ...,
have decimal periods of length
and differ only by a cyclic
permutation. Such numbers
are called full reptend primes.
To find denominators with short decimal periods, note that
|
(11)
| |||
|
(12)
| |||
|
(13)
| |||
|
(14)
| |||
|
(15)
| |||
|
(16)
| |||
|
(17)
| |||
|
(18)
| |||
|
(19)
| |||
|
(20)
| |||
|
(21)
| |||
|
(22)
|
The decimal period of a fraction with denominator equal
to a prime factor above
is therefore the power of 10 in which the factor
first appears. For example, 37 appears in the factorization
of
and
,
so its decimal period is 3. Multiplication
of any factor by a
still gives the same decimal
period as the factor alone. A denominator
greater than 1 and relatively prime to 10 has
decimal period equal
to the least positive integer
for which the entire denominator,
including all prime power multiplicities, divides
.
For example, 11 has decimal period 2, whereas
has decimal
period 22. The following table gives the primes
having small decimal periods (OEIS A007138,
A046107, and A046108;
Ogilvy and Anderson 1988).
| period | primes |
| 1 | 3 |
| 2 | 11 |
| 3 | 37 |
| 4 | 101 |
| 5 | 41, 271 |
| 6 | 7, 13 |
| 7 | 239, 4649 |
| 8 | 73, 137 |
| 9 | 333667 |
| 10 | 9091 |
| 11 | 21649, 513239 |
| 12 | 9901 |
| 13 | 53, 79, 265371653 |
| 14 | 909091 |
| 15 | 31, 2906161 |
| 16 | 17, 5882353 |
| 17 | 2071723, 5363222357 |
| 18 | 19, 52579 |
| 19 | 1111111111111111111 |
| 20 | 3541, 27961 |
A table of the decimal periods of small odd primes
other than the special
, for which the decimal expansion is not periodic, follows
(OEIS A002371).
| 3 | 1 | 31 | 15 | 67 | 33 |
| 7 | 6 | 37 | 3 | 71 | 35 |
| 11 | 2 | 41 | 5 | 73 | 8 |
| 13 | 6 | 43 | 21 | 79 | 13 |
| 17 | 16 | 47 | 46 | 83 | 41 |
| 19 | 18 | 53 | 13 | 89 | 44 |
| 23 | 22 | 59 | 58 | 97 | 96 |
| 29 | 28 | 61 | 60 | 101 | 4 |
Shanks (1873ab) computed the decimal periods for all primes up to and published those up to
.