Selasa, 07 Mei 2013

Decimal Notation

Decimal notation is the writing of numbers in a base-10 numeral system. Examples are Roman numerals, Brahmi numerals, and Chinese numerals, as well as the Hindu-Arabic numerals used by speakers of many European languages. Roman numerals have symbols for the decimal powers (1, 10, 100, 1000) and secondary symbols for half these values (5, 50, 500). Brahmi numerals have symbols for the nine numbers 1–9, the nine decades 10–90, plus a symbol for 100 and another for 1000. Chinese numerals have symbols for 1–9, and additional symbols for powers of 10, which in modern usage reach 1044.
However, when people who use Hindu-Arabic numerals speak of decimal notation, they often mean not just decimal numeration, as above, but also decimal fractions, all conveyed as part of a positional system. Positional decimal systems include a zero and use symbols (called digits) for the ten values (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9) to represent any number, no matter how large or how small. These digits are often used with a decimal separator which indicates the start of a fractional part, and with a symbol such as the plus sign + (for positive) or minus sign − (for negative) adjacent to the numeral to indicate whether it is greater or less than zero, respectively.
Positional notation uses positions for each power of ten: units, tens, hundreds, thousands, etc. The position of each digit within a number denotes the multiplier (power of ten) multiplied with that digit—each position has a value ten times that of the position to its right. There were at least two presumably independent sources of positional decimal systems in ancient civilization: the Chinese counting rod system and the Hindu-Arabic numeral system (the latter descended from Brahmi numerals).
Ten is the number which is the count of fingers and thumbs on both hands (or toes on the feet). The English word digit as well as its translation in many languages is also the anatomical term for fingers and toes. In English, decimal (decimus < Lat.) means tenth, decimate means reduce by a tenth, and denary (denarius < Lat.) means the unit of ten.
The symbols for the digits in common use around the globe today are called Arabic numerals by Europeans and Indian numerals by Arabs, the two groups' terms both referring to the culture from which they learned the system. However, the symbols used in different areas are not identical; for instance, Western Arabic numerals (from which the European numerals are derived) differ from the forms used by other Arab cultures.

Decimal fractions

A decimal fraction is a fraction whose denominator is a power of ten.
Decimal fractions are commonly expressed without a denominator, the decimal separator being inserted into the numerator (with leading zeros added if needed) at the position from the right corresponding to the power of ten of the denominator; e.g., 8/10, 83/100, 83/1000, and 8/10000 are expressed as 0.8, 0.83, 0.083, and 0.0008. In English-speaking, some Latin American and many Asian countries, a period (.) or raised period (·) is used as the decimal separator; in many other countries, particularly in Europe, a comma is used.
The integer part, or integral part of a decimal number is the part to the left of the decimal separator. (See also truncation.) The part from the decimal separator to the right is the fractional part. It is usual for a decimal number that consists only of a fractional part, (mathematically, a proper fraction), to have a leading zero in its notation (its numeral). This helps disambiguation between a decimal sign and other punctuation, and especially when the negative number sign is indicated, it helps visualize the sign of the numeral as a whole.
Trailing zeros after the decimal point are not necessary, although in science, engineering and statistics they can be retained to indicate a required precision or to show a level of confidence in the accuracy of the number: Although 0.080 and 0.08 are numerically equal, in engineering 0.080 suggests a measurement with an error of up to one part in two thousand (±0.0005), while 0.08 suggests a measurement with an error of up to one in two hundred (see significant figures).

Other rational numbers

Any rational number with a denominator whose only prime factors are 2 and/or 5 may be precisely expressed as a decimal fraction and has a finite decimal expansion.
1/2 = 0.5
1/20 = 0.05
1/5 = 0.2
1/50 = 0.02
1/4 = 0.25
1/40 = 0.025
1/25 = 0.04
1/8 = 0.125
1/125= 0.008
1/10 = 0.1
If the rational number's denominator has any prime factors other than 2 or 5, it cannot be expressed as a finite decimal fraction, and has a unique eventually repeating infinite decimal expansion.
1/3 = 0.333333… (with 3 repeating)
1/9 = 0.111111… (with 1 repeating)
100-1=99=9×11
1/11 = 0.090909… (with 09 repeating)
1000-1=9×111=27×37
1/27 = 0.037037037…
1/37 = 0.027027027…
1/111 = 0 .009009009…
also:
1/81= 0.012345679012… (with 012345679 repeating)
That a rational number must have a finite or recurring decimal expansion can be seen to be a consequence of the long division algorithm, in that there are only q-1 possible nonzero remainders on division by q, so that the recurring pattern will have a period less than q. For instance, to find 3/7 by long division:
     0.4 2 8 5 7 1 4 ...
 7 ) 3.0 0 0 0 0 0 0 0
     2 8                         30/7 = 4 r 2
       2 0
       1 4                       20/7 = 2 r 6
         6 0
         5 6                     60/7 = 8 r 4
           4 0
           3 5                   40/7 = 5 r 5
             5 0
             4 9                 50/7 = 7 r 1
               1 0
                 7               10/7 = 1 r 3
                 3 0
                 2 8             30/7 = 4 r 2
                   2 0
                        etc.
The converse to this observation is that every recurring decimal represents a rational number p/q. This is a consequence of the fact that the recurring part of a decimal representation is, in fact, an infinite geometric series which will sum to a rational number. For instance,
0.0123123123\cdots = \frac{123}{10000} \sum_{k=0}^\infty 0.001^k = \frac{123}{10000}\ \frac{1}{1-0.001} = \frac{123}{9990} = \frac{41}{3330}

Real numbers

Every real number has a (possibly infinite) decimal representation; i.e., it can be written as
 x = \mathop{\rm sign}(x) \sum_{i\in\mathbb Z} a_i\,10^i
where
  • sign() is the sign function, and
  • ai ∈ { 0,1,…,9 } for all iZ are its decimal digits, equal to zero for all i greater than some number (that number being the common logarithm of |x|).
Such a sum converges as i increases, even if there are infinitely many non-zero ai.
Rational numbers (e.g., p/q) with prime factors in the denominator other than 2 and 5 (when reduced to simplest terms) have a unique recurring decimal representation.

Non-uniqueness of decimal representation

Consider those rational numbers which have only the factors 2 and 5 in the denominator, i.e., which can be written as p/(2a5b). In this case there is a terminating decimal representation. For instance, 1/1 = 1, 1/2 = 0.5, 3/5 = 0.6, 3/25 = 0.12 and 1306/1250 = 1.0448. Such numbers are the only real numbers which do not have a unique decimal representation, as they can also be written as a representation that has a recurring 9, for instance 1 = 0.99999…, 1/2 = 0.499999…, etc. The number 0 = 0/1 is special in that it has no representation with recurring 9.
This leaves the irrational numbers. They also have unique infinite decimal representations, and can be characterised as the numbers whose decimal representations neither terminate nor recur.
So in general the decimal representation is unique, if one excludes representations that end in a recurring 9.
The same trichotomy holds for other base-n positional numeral systems:
  • Terminating representation: rational where the denominator divides some nk
  • Recurring representation: other rational
  • Non-terminating, non-recurring representation: irrational
A version of this even holds for irrational-base numeration systems, such as golden mean base representation.

Decimal computation

Decimal computation was/is carried out in ancient times in many ways, typically in Rod calculus, on sand tables or with a variety of abaci.
Modern computer hardware and software systems commonly use a binary representation internally (although many early computers, such as the ENIAC or the IBM 650, used decimal representation internally). For external use by computer specialists, this binary representation is sometimes presented in the related octal or hexadecimal systems.
For most purposes, however, binary values are converted to or from the equivalent decimal values for presentation to or input from humans; computer programs express literals in decimal by default. (123.1, for example, is written as such in a computer program, even though many computer languages are unable to encode that number precisely.)
Both computer hardware and software also use internal representations which are effectively decimal for storing decimal values and doing arithmetic. Often this arithmetic is done on data which are encoded using some variant of binary-coded decimal, especially in database implementations, but there are other decimal representations in use (such as in the new IEEE 754 Standard for Floating-Point Arithmetic).
Decimal arithmetic is used in computers so that decimal fractional results can be computed exactly, which is not possible using a binary fractional representation. This is often important for financial and other calculations.

History

Many ancient cultures calculated from early on with numerals based on ten: Egyptian hieroglyphs, in evidence since around 3000 BC, used a purely decimal system, just as the Cretan hieroglyphs (ca. 1625−1500 BC) of the Minoans whose numerals are closely based on the Egyptian model. The decimal system was handed down to the consecutive Bronze Age cultures of Greece, including Linear A (ca. 18th century BC−1450 BC) and Linear B (ca. 1375−1200 BC) — the number system of classical Greece also used powers of ten, including, like the Roman numerals did, an intermediate base of 5. Notably, the polymath Archimedes (c. 287–212 BC) invented a decimal positional system in his Sand Reckoner which was based on 108 and later led the German mathematician Carl Friedrich Gauss to lament what heights science would have already reached in his days if Archimedes had fully realized the potential of his ingenious discovery. The Hittites hieroglyphs (since 15th century BC), just like the Egyptian and early numerals in Greece, was strictly decimal.
The Egyptian hieratic numerals, the Greek alphabet numerals, the Roman numerals, the Chinese numerals and early Indian Brahmi numerals are all non-positional decimal systems, and required large numbers of symbols. For instance, Egyptian numerals used different symbols for 10, 20, through 90, 100, 200, through 900, 1000, 2000, 3000, 4000, to 10,000.

History of decimal fractions


counting rod decimal fraction 1/7
According to Joseph Needham, decimal fractions were first developed and used by the Chinese in the 1st century BC, and then spread to the Middle East and from there to Europe.The written Chinese decimal fractions were non-positional. However, counting rod fractions were positional.
Qin Jiushao in his book Mathematical Treatise in Nine Sections (1247) denoted 0.96644 by
Counting rod 0.pngCounting rod h9 num.pngCounting rod v6.pngCounting rod h6.pngCounting rod v4.pngCounting rod h4.png, meaning
096644

The Jewish mathematician Immanuel Bonfils invented decimal fractions around 1350, anticipating Simon Stevin, but did not develop any notation to represent them.
The Persian mathematician Jamshīd al-Kāshī claimed to have discovered decimal fractions himself in the 15th century, though J. Lennart Berggren notes that positional decimal fractions were used five centuries before him by Arab mathematician Abu'l-Hasan al-Uqlidisi as early as the 10th century.
Khwarizmi introduced fractions to Islamic countries in the early 9th century. . This form of fraction with the numerator on top and the denominator on the bottom, without a horizontal bar, was also used in the 10th century by Abu'l-Hasan al-Uqlidisi and again in the 15th century work "Arithmetic Key" by Jamshīd al-Kāshī.[citation needed]
Stevin-decimal notation.png
A forerunner of modern European decimal notation was introduced by Simon Stevin in the 16th century.

Natural languages

Telugu language uses a straightforward decimal system. Other Dravidian languages such as Tamil and Malayalam have replaced the number nine tondu with 'onpattu' ("one to ten") during the early Middle Ages, while Telugu preserved the number nine as tommidi.
The Hungarian language also uses a strightforward decimal system. Unlike many indo-european languages, there is no exception between 10 and 20 (e.g. 11 is expressed as "tízenegy" litterarly "one on ten") or between 20-100 (23 as "huszonhárom" = "three on twenty") and the ones never precede the tens (like in german, e.g. "dreiundzwanzig" = 23).
A straightforward decimal rank system with a word for each order 10十,100百,1000千,10000万, and in which 11 is expressed as ten-one and 23 as two-ten-three, and 89345 is expressed as 8 (ten thousands) 万9 (thousand) 千3 (hundred) 百4 (tens) 十 5 is found in Chinese languages, and in Vietnamese with a few irregularities. Japanese, Korean, and Thai have imported the Chinese decimal system. Many other languages with a decimal system have special words for the numbers between 10 and 20, and decades. For example in English 11 is "eleven" not "ten-one".
Incan languages such as Quechua and Aymara have an almost straightforward decimal system, in which 11 is expressed as ten with one and 23 as two-ten with three.
Some psychologists suggest irregularities of the English names of numerals may hinder children's counting ability.

 

Positional Notation

Positional notation or place-value notation is a method of representing or encoding numbers. Positional notation is distinguished from other notations (such as Roman numerals) for its use of the same symbol for the different orders of magnitude (for example, the "ones place", "tens place", "hundreds place"). This greatly simplified arithmetic and led to the quick spread of the notation across the world.
With the use of a radix point (decimal point), the notation can be extended to include fractions and the numeric expansions of real numbers. The Hindu–Arabic numeral system is an example for a positional notation, based on the number 10.

History

Today, the base-10 (decimal) system, which is likely motivated by counting with the ten fingers, is ubiquitous. Other bases have been used in the past however, and some continue to be used today. For example, the Babylonian numeral system, credited as the first positional number system, was base-60. Counting rods and most abacuses have been used to represent numbers in a positional numeral system, but it lacked a real 0 value. 0 was indicated by a space between sexagesimal numerals. By 300 BC, a punctuation symbol (two slanted wedges) was co-opted as a placeholder in the same Babylonian system. In a tablet unearthed at Kish (dating from about 700 BC), the scribe Bêl-bân-aplu wrote his zeros with three hooks, rather than two slanted wedges. The Babylonian placeholder was not a true zero because it was not used alone. Nor was it used at the end of a number. Thus numbers like 2 and 120 (2×60), 3 and 180 (3×60), 4 and 240 (4×60), looked the same because the larger numbers lacked a final sexagesimal placeholder. Only context could differentiate them.
Before positional notation became standard, simple additive systems (sign-value notation) such as Roman Numerals were used, and accountants in ancient Rome and during the Middle Ages used the abacus or stone counters to do arithmetic.
With counting rods or abacus to perform arithmetic operations, the writing of the starting, intermediate and final values of a calculation could easily be done with a simple additive system in each position or column. This approach required no memorization of tables (as does positional notation) and could produce practical results quickly. For four centuries (from the 13th to the 16th) there was strong disagreement between those who believed in adopting the positional system in writing numbers and those who wanted to stay with the additive-system-plus-abacus. Although electronic calculators have largely replaced the abacus, the latter continues to be used in Japan and other Asian countries.
Georges Ifrah concludes in his Universal History of Numbers:
This it would seem highly probable under the circumstances that the discovery of zero and the place-value system were inventions unique to the Indian civilization. As the Brahmi notation of the first nine whole numbers (incontestably the graphical origin of our present-day numerals and of all the decimal numeral systems in use in India, Southeast and Central Asia and the Near East) was autochthonous and free of any outside influence, there can be no doubt that our decimal place-value system was born in India and was the product of Indian civilization alone.
Aryabhata stated "sthānam sthānam daśa guṇam" meaning "From place to place, ten times in value". Indian mathematicians and astronomers also developed Sanskrit positional number words to describe astronomical facts or algorithms using poetic sutras. A key argument against the positional system was its susceptibility to easy fraud by simply putting a number at the beginning or end of a quantity, thereby changing (e.g.) 100 into 5100, or 100 into 1000. Modern cheques require a natural language spelling of an amount, as well as the decimal amount itself, to prevent such fraud. For the same reason the Chinese also use natural language numerals, for example 100 is written as 壹佰, which can never be forged into 壹仟(1000) or 伍仟壹佰(5100).

Base of the numeral system

In mathematical numeral systems, the base or radix is usually the number of unique digits, including zero, that a positional numeral system uses to represent numbers. For example, for the decimal system the radix is 10, because it uses the 10 digits from 0 through 9. When a number "hits" 9, the next number will not be another different symbol, but a "1" followed by a "0". In binary, the radix is 2, since after it hits "1", instead of "2" or another written symbol, it jumps straight to "10", followed by "11" and "100".
The highest symbol of a positional numeral system usually has the value one less than the value of the base of that numeral system. The standard positional numeral systems differ from one another only in the base they use.
The base is an integer that is greater than 1 (or less than negative 1), since a radix of zero would not have any digits, and a radix of 1 would only have the zero digit. Negative bases are rarely used. In a system with a negative radix, numbers may have many different possible representations.
(In certain non-standard positional numeral systems, including bijective numeration, the definition of the base or the allowed digits deviates from the above.)
In base-10 (decimal) positional notation, there are 10 decimal digits and the number
2506 = 2 \times 10^3 + 5 \times 10^2 + 0 \times 10^1 + 6 \times 10^0.
In base-16 (hexadecimal), there are 16 hexadecimal digits (0–9 and A–F) and the number
171\mathrm{B} = 1 \times 16^3 + 7 \times 16^2 + 1 \times 16^1 + \mathrm{B} \times 16^0 (where B represents the number eleven as a single symbol)
In general, in base-b, there are b digits and the number
a_3 a_2 a_1 a_0 = a_3 \times b^3 + a_2 \times b^2 + a_1 \times b^1 + a_0 \times b^0 (Note that a_3 a_2 a_1 a_0 represents a sequence of digits, not multiplication)

Notation

Sometimes the base number is written in subscript after the number represented. For example, 238 indicates that the number 23 is expressed in base 8 (and is therefore equivalent in value to the decimal number 19). This notation will be used in this article.
When describing base in mathematical notation, the letter b is generally used as a symbol for this concept, so, for a binary system, b equals 2. Another common way of expressing the base is writing it as a decimal subscript after the number that is being represented. 11110112 implies that the number 1111011 is a base-2 number, equal to 12310 (a decimal notation representation), 1738 (octal) and 7B16 (hexadecimal). When using the written abbreviations of number bases, the base is not printed: Binary 1111011 is the same as 11110112.
The base b may also be indicated by the phrase "base-b". So binary numbers are "base-2"; octal numbers are "base-8"; decimal numbers are "base-10"; and so on.
Numbers of a given radix b have digits {0, 1, ..., b−2, b−1}. Thus, binary numbers have digits {0, 1}; decimal numbers have digits {0, 1, 2, ..., 8, 9}; and so on. Thus the following are notational errors: 522, 22, 1A9. (In all cases, one or more digits is not in the set of allowed digits for the given base.)

Exponentiation

Positional number systems work using exponentiation of the base. A digit's value is the digit multiplied by the value of its place. Place values are the number of the base raised to the nth power, where n is the number of other digits between a given digit and the radix point. If a given digit is on the left hand side of the radix point (i.e. its value is an integer) then n is positive or zero; if the digit is on the right hand side of the radix point (i.e., its value is fractional) then n is negative.
As an example of usage, the number 465 in its respective base b (which must be at least base 7 because the highest digit in it is 6) is equal to:
4\times b^2 + 6\times b^1 + 5\times b^0
If the number 465 was in base-10, then it would equal:
4\times 10^2 + 6\times 10^1 + 5\times 10^0 = 4\times 100 + 6\times 10 + 5\times 1 = 465
(46510 = 46510)
If however, the number were in base 7, then it would equal:
4\times 7^2 + 6\times 7^1 + 5\times 7^0 = 4\times 49 + 6\times 7 + 5\times 1 = 243
(4657 = 24310)
10b = b for any base b, since 10b = 1×b1 + 0×b0. For example 102 = 2; 103 = 3; 1016 = 1610. Note that the last "16" is indicated to be in base 10. The base makes no difference for one-digit numerals.
Numbers that are not integers use places beyond a radix point. For every position behind this point (and thus after the units digit), the power n decreases by 1. For example, the number 2.35 is equal to:
2\times 10^0 + 3\times 10^{-1} + 5\times 10^{-2}
This concept can be demonstrated using a diagram. One object represents one unit. When the number of objects is equal to or greater than the base b, then a group of objects is created with b objects. When the number of these groups exceeds b, then a group of these groups of objects is created with b groups of b objects; and so on. Thus the same number in different bases will have different values:

241 in base 5:
   2 groups of 52 (25)           4 groups of 5          1 group of 1
   ooooo    ooooo
   ooooo    ooooo                ooooo   ooooo
   ooooo    ooooo         +                         +         o
   ooooo    ooooo                ooooo   ooooo
   ooooo    ooooo
241 in base 8:
   2 groups of 82 (64)          4 groups of 8          1 group of 1
 oooooooo  oooooooo
 oooooooo  oooooooo
 oooooooo  oooooooo         oooooooo   oooooooo
 oooooooo  oooooooo    +                            +        o
 oooooooo  oooooooo
 oooooooo  oooooooo         oooooooo   oooooooo
 oooooooo  oooooooo
 oooooooo  oooooooo
The notation can be further augmented by allowing a leading minus sign. This allows the representation of negative numbers. For a given base, every representation corresponds to exactly one real number and every real number has at least one representation. The representations of rational numbers are those representations that are finite, use the bar notation, or end with an infinitely repeating cycle of digits.

Digits and numerals

A digit is what is used as a position in place-value notation, and a numeral is one or more digits. Today's most common digits are the decimal digits "0", "1", "2", "3", "4", "5", "6", "7", "8", and "9". The distinction between a digit and a numeral is most pronounced in the context of a number base.
A non-zero numeral with more than one digit position will mean a different number in a different number base, but in general, the digits will mean the same. The base-8 numeral 238 contains two digits, "2" and "3", and with a base number (subscripted) "8", means 19. In our notation here, the subscript "8" of the numeral 238 is part of the numeral, but this may not always be the case. Imagine the numeral "23" as having an ambiguous base number. Then "23" could likely be any base, base-4 through base-60. In base-4 "23" means 11, and in base-60 it means the number 123. The numeral "23" then, in this case, corresponds to the set of numbers {11, 13, 15, 17, 19, 21, 23, ..., 121, 123} while its digits "2" and "3" always retain their original meaning: the "2" means "two of", and the "3" three.
In certain applications when a numeral with a fixed number of positions needs to represent a greater number, a higher number-base with more digits per position can be used. A three-digit, decimal numeral can represent only up to 999. But if the number-base is increased to 11, say, by adding the digit "A", then the same three positions, maximized to "AAA", can represent a number as great as 1330. We could increase the number base again and assign "B" to 11, and so on (but there is also a possible encryption between number and digit in the number-digit-numeral hierarchy). A three-digit numeral "ZZZ" in base-60 could mean 215,999. If we use the entire collection of our alphanumerics we could ultimately serve a base-62 numeral system, but we remove two digits, uppercase "I" and uppercase "O", to reduce confusion with digits "1" and "0". We are left with a base-60, or sexagesimal numeral system utilizing 60 of the 62 standard alphanumerics. (But see Sexagesimal system below.)
The common numeral systems in computer science are binary (radix 2), octal (radix 8), and hexadecimal (radix 16). In binary only digits "0" and "1" are in the numerals. In the octal numerals, are the eight digits 0–7. Hex is 0–9 A–F, where the ten numerics retain their usual meaning, and the alphabetics correspond to values 10–15, for a total of sixteen digits. The numeral "10" is binary numeral "2", octal numeral "8", or hexadecimal numeral "16".

Base conversion

Bases can be converted between each other by drawing the diagram above and rearranging the objects to conform to the new base, for example:
241 in base 5:
   2 groups of 52           4 groups of 5          1 group of 1
   ooooo    ooooo
   ooooo    ooooo           ooooo   ooooo
   ooooo    ooooo     +                        +         o
   ooooo    ooooo           ooooo   ooooo
   ooooo    ooooo
is equal to 107 in base 8:
    1 group of 82           0 groups of 8          7 groups of 1
      oooooooo
      oooooooo                                       
      oooooooo
      oooooooo        +                        +      ooooooo             
      oooooooo
      oooooooo                                       
      oooooooo
      oooooooo
There is, however, a shorter method which is basically the above method calculated mathematically. Because we work in base-10 normally, it is easier to think of numbers in this way and therefore easier to convert them to base-10 first, though it is possible (but difficult if one is not used to the base the conversion is being performed in) to convert straight between non-decimal bases without using this intermediate step. (However, conversion from bases like 8, 16 or 256 to base-2 can be achieved by writing each digit in binary notation, and subsequently, conversion from base-2 to e.g. base-16 can be achieved by writing each group of four binary digits as one hexadecimal digit.)
A number anan−1...a2a1a0 where a0, a1 ... an are all digits in a base b (note that here, the subscript does not refer to the base number; it refers to different objects), the number can be represented in any other base, including decimal, by:
\sum_{i=0}^n \left( a_i\times b^i \right)
Thus, in the example above:
241_5 = 2\times 5^2 + 4\times 5^1 + 1\times 5^0 = 50 + 20 + 1 = 71_{10}
To convert from decimal to another base one must simply start dividing by the value of the other base, then dividing the result of the first division and overlooking the remainder, and so on until the base is larger than the result (so the result of the division would be a zero). Then the number in the desired base is the remainders, the most significant value being the one corresponding to the last division and the least significant value being the remainder of the first division.
Example #1 decimal to septal:
\begin{align}123_{10} = 123 / 7 = 17\text{ with a remainder of }(4)\\
17 / 7 = 2\text{ with a remainder of }(3)\\
2 / 7 = 0\text{ with a remainder of }(2)\\
&= 234_7\end{align}
Example #2 decimal to octal:
\begin{align}456_{10} = 456 / 8 = 57\text{ with a remainder of }(0)\\
57 / 8 = 7\text{ with a remainder of }(1)\\
7 / 8 = 0\text{ with a remainder of }(7)\\
&= 710_8\end{align}
The most common example is that of changing from decimal to binary.

Infinite representations

 

The representation of non-integers can be extended to allow an infinite string of digits beyond the point. For example 1.12112111211112 ... base-3 represents the sum of the infinite series:
1\times 3^{0\,\,\,} + {}
1\times 3^{-1\,\,} + 2\times 3^{-2\,\,\,} + {}
1\times 3^{-3\,\,} + 1\times 3^{-4\,\,\,} + 2\times 3^{-5\,\,\,} + {}
1\times 3^{-6\,\,} + 1\times 3^{-7\,\,\,} + 1\times 3^{-8\,\,\,} + 2\times 3^{-9\,\,\,} + {}
1\times 3^{-10} + 1\times 3^{-11} + 1\times 3^{-12} + 1\times 3^{-13} + 2\times 3^{-14} + \cdots
Since a complete infinite string of digits cannot be explicitly written, the trailing ellipsis (...) designates the omitted digits, which may or may not follow a pattern of some kind. One common pattern is when a finite sequence of digits repeats infinitely. This is designated by drawing a bar across the repeating block:
2.42\overline{314}_5 = 2.42314314314314314\dots_5
For base-10 it is called a recurring decimal or repeating decimal.
An irrational number has an infinite non-repeating representation in all integer bases. Whether a rational number has a finite representation or requires an infinite repeating representation depends on the base. For example, one third can be represented by:
0.1_3\,
0.\overline3_{10} = 0.3333333\dots_{10}
or, with the base implied:
0.\overline3 = 0.3333333\dots
0.\overline{01}_2 = 0.010101\dots_2
0.2_6\,
For integers p and q with gcd(p, q) = 1, the fraction p/q has a finite representation in base b if and only if each prime factor of q is also a prime factor of b.
For a given base, any number that can be represented by a finite number of digits (without using the bar notation) will have multiple representations, including one or two infinite representations:
1. A finite or infinite number of zeroes can be appended:
3.46_7 = 3.460_7 = 3.460000_7 = 3.46\overline0_7
2. The last non-zero digit can be reduced by one and an infinite string of digits, each corresponding to one less than the base, are appended (or replace any following zero digits):
3.46_7 = 3.45\overline6_7
1_{10} = 0.\overline9_{10}
220_5 = 214.\overline4_5

Applications

Decimal system

In the decimal (base-10) Hindu–Arabic numeral system, each position starting from the right is a higher power of 10. The first position represents 100 (1), the second position 101 (10), the third position 102 (10 × 10 or 100), the fourth position 103 (10 × 10 × 10 or 1000), and so on.
Fractional values are indicated by a separator, which varies by locale. Usually this separator is a period or full stop, or a comma. Digits to the right of it are multiplied by 10 raised to a negative power or exponent. The first position to the right of the separator indicates 10−1 (0.1), the second position 10−2 (0.01), and so on for each successive position.
As an example, the number 2674 in a base-10 numeral system is:
(2 × 103) + (6 × 102) + (7 × 101) + (4 × 100)
or
(2 × 1000) + (6 × 100) + (7 × 10) + (4 × 1).

Sexagesimal system

The sexagesimal or base-60 system was used for the integral and fractional portions of Babylonian numerals and other mesopotamian systems, by Hellenistic astronomers using Greek numerals for the fractional portion only, and is still used for modern time and angles, but only for minutes and seconds. However, not all of these uses were positional.
Modern time separates each position by a colon or point. For example, the time might be 10:25:59 (10 hours 25 minutes 59 seconds). Angles use similar notation. For example, an angle might be 10°25'59" (10 degrees 25 minutes 59 seconds). In both cases, only minutes and seconds use sexagesimal notation—angular degrees can be larger than 59 (one rotation around a circle is 360°, two rotations are 720°, etc.), and both time and angles use decimal fractions of a second. This contrasts with the numbers used by Hellenistic and Renaissance astronomers, who used thirds, fourths, etc. for finer increments. Where we might write 10°25'59.392", they would have written 10°25′59″23‴31''''12''''' or 10°25I59II23III31IV12V.
Using a digit set of digits with upper and lowercase letters allows short notation for sexagesimal numbers, e.g. 10:25:59 becomes 'ARz' (by omitting I and O, but not i and o), which is useful for use in URLs, etc., but it is not very intelligible to humans.
In the 1930s, Otto Neugebauer introduced a modern notational system for Babylonian and Hellenistic numbers that substitutes modern decimal notation from 0 to 59 in each position, while using a semicolon (;) to separate the integral and fractional portions of the number and using a comma (,) to separate the positions within each portion. For example, the mean synodic month used by both Babylonian and Hellenistic astronomers and still used in the Hebrew calendar is 29;31,50,8,20 days, and the angle used in the example above would be written 10;25,59,23,31,12 degrees.

Computing

In computing, the binary (base-2) and hexadecimal (base-16) bases are used. Computers, at the most basic level, deal only with sequences of conventional zeroes and ones, thus it is easier in this sense to deal with powers of two. The hexadecimal system is used as "shorthand" for binary—every 4 binary digits (bits) relate to one and only one hexadecimal digit. In hexadecimal, the six digits after 9 are denoted by A, B, C, D, E, and F (and sometimes a, b, c, d, e, and f).
The octal numbering system is also used as another way to represent binary numbers. In this case the base is 8 and therefore only digits 0, 1, 2, 3, 4, 5, 6, and 7 are used. When converting from binary to octal every 3 bits relate to one and only one octal digit.

Other bases in human language

Base-12 systems (duodecimal or dozenal) have been popular because multiplication and division are easier than in base-10, with addition and subtraction being just as easy. Twelve is a useful base because it has many factors. It is the smallest common multiple of one, two, three, four and six. There is still a special word for "dozen" in English, and by analogy with the word for 102, hundred, commerce developed a word for 122, gross. The standard 12-hour clock and common use of 12 in English units emphasize the utility of the base. In addition, prior to its conversion to decimal, the old British currency Pound Sterling (GBP) partially used base-12; there were 12 pence (d) in a shilling (s), 20 shillings in a pound (£), and therefore 240 pence in a pound. Hence the term LSD or, more properly, £sd.
The Maya civilization and other civilizations of pre-Columbian Mesoamerica used base-20 (vigesimal), as did several North American tribes (two being in southern California). Evidence of base-20 counting systems is also found in the languages of central and western Africa.
Remnants of a Gaulish base-20 system also exist in French, as seen today in the names of the numbers from 60 through 99. For example, sixty-five is soixante-cinq (literally, "sixty [and] five"), while seventy-five is soixante-quinze (literally, "sixty [and] fifteen"). Furthermore, for any number between 80 and 99, the "tens-column" number is expressed as a multiple of twenty (somewhat similar to the archaic English manner of speaking of "scores", probably originating from the same underlying Celtic system). For example, eighty-two is quatre-vingt-deux (literally, four twenty[s] [and] two), while ninety-two is quatre-vingt-douze (literally, four twenty[s] [and] twelve). In Old French, forty was expressed as two twenties and sixty was three twenties, so that fifty-three was expressed as two twenties [and] thirteen, and so on.
The Irish language also used base-20 in the past, twenty being fichid, forty dhá fhichid, sixty trí fhichid and eighty ceithre fhichid. A remnant of this system may be seen in the modern word for 40, daoichead.
The Welsh language continues to use a base-20 counting system, particularly for the age of people, dates and in common phrases. 15 is also important, with 16–19 being "one on 15", "two on 15" etc. 18 is normally "two nines". A decimal system is commonly used.
Danish numerals display a similar base-20 structure.
The Maori language of New Zealand also has evidence of an underlying base-20 system as seen in the terms Te Hokowhitu a Tu referring to a war party (literally "the seven 20s of Tu") and Tama-hokotahi, referring to a great warrior ("the one man equal to 20").
The binary system was used in the Egyptian Old Kingdom, 3000 BC to 2050 BC. It was cursive by rounding off rational numbers smaller than 1 to 1/2 + 1/4 + 1/8 + 1/16 + 1/32 + 1/64, with a 1/64 term thrown away (the system was called the Eye of Horus).
A number of Australian Aboriginal languages employ binary or binary-like counting systems. For example, in Kala Lagaw Ya, the numbers one through six are urapon, ukasar, ukasar-urapon, ukasar-ukasar, ukasar-ukasar-urapon, ukasar-ukasar-ukasar.
North and Central American natives used base-4 (quaternary) to represent the four cardinal directions. Mesoamericans tended to add a second base-5 system to create a modified base-20 system.
A base-5 system (quinary) has been used in many cultures for counting. Plainly it is based on the number of digits on a human hand. It may also be regarded as a sub-base of other bases, such as base-10, base-20, and base-60.
A base-8 system (octal) was devised by the Yuki tribe of Northern California, who used the spaces between the fingers to count, corresponding to the digits one through eight.[citation needed] There is also linguistic evidence which suggests that the Bronze Age Proto-Indo Europeans (from whom most European and Indic languages descend) might have replaced a base-8 system (or a system which could only count up to 8) with a base-10 system. The evidence is that the word for 9, newm, is suggested by some to derive from the word for "new", newo-, suggesting that the number 9 had been recently invented and called the "new number".
Many ancient counting systems use five as a primary base, almost surely coming from the number of fingers on a person's hand. Often these systems are supplemented with a secondary base, sometimes ten, sometimes twenty. In some African languages the word for five is the same as "hand" or "fist" (Dyola language of Guinea-Bissau, Banda language of Central Africa). Counting continues by adding 1, 2, 3, or 4 to combinations of 5, until the secondary base is reached. In the case of twenty, this word often means "man complete". This system is referred to as quinquavigesimal. It is found in many languages of the Sudan region.
The Telefol language, spoken in Papua New Guinea, is notable for possessing a base-27 numeral system.

Non-standard positional numeral systems

Interesting properties exist when the base is not fixed or positive and when the digit symbol sets denote negative values. There are many more variations. These systems are of practical and theoretic value to computer scientists.
Balanced ternary uses a base of 3 but the digit set is {1,0,1} instead of {0,1,2}. The "1" has an equivalent value of −1. The negation of a number is easily formed by switching the    on the 1s. This system can be used to solve the balance problem, which requires finding a minimal set of known counter-weights to determine an unknown weight. Weights of 1, 3, 9, ... 3n known units can be used to determine any unknown weight up to 1 + 3 + ... + 3n units. A weight can be used on either side of the balance or not at all. Weights used on the balance pan with the unknown weight are designated with 1, with 1 if used on the empty pan, and with 0 if not used. If an unknown weight W is balanced with 3 (31) on its pan and 1 and 27 (30 and 33) on the other, then its weight in decimal is 25 or 1011 in balanced base-3. (10113 = 1 × 33 + 0 × 32 − 1 × 31 + 1 × 30 = 25).
The factorial number system uses a varying radix, giving factorials as place values; they are related to Chinese remainder theorem and Residue number system enumerations. This system effectively enumerates permutations. A derivative of this uses the Towers of Hanoi puzzle configuration as a counting system. The configuration of the towers can be put into 1-to-1 correspondence with the decimal count of the step at which the configuration occurs and vice versa.
Decimal equivalents: −3 −2 −1 0 1 2 3 4 5 6 7 8
Balanced base-3: 10 11 1 0 1 11 10 11 111 110 111 101
Base −2: 1101 10 11 0 1 110 111 100 101 11010 11011 11000
Factoroid:


0 10 100 110 200 210 1000 1010 1100

Non-positional positions

Each position does not need to be positional itself. Babylonian sexagesimal numerals were positional, but in each position were groups of two kinds of wedges representing ones and tens (a narrow vertical wedge ( | ) and an open left pointing wedge (<))—up to 14 symbols per position (5 tens (<<<<<) and 9 ones ( ||||||||| ) grouped into one or two near squares containing up to three tiers of symbols, or a place holder (\\) for the lack of a position). Hellenistic astronomers used one or two alphabetic Greek numerals for each position (one chosen from 5 letters representing 10–50 and/or one chosen from 9 letters representing 1–9, or a zero symbol).

 

Lehmer Code

In mathematics and in particular in combinatorics, the Lehmer code is a particular way to encode each possible permutation of a sequence of n numbers. It is an instance of a scheme for numbering permutations and is an example of an inversion table.

The code

The Lehmer code makes evident the fact that there are
n!=n\times(n-1)\times\cdots\times2\times1
permutations of a sequence of n numbers. If a permutation σ is specified by the sequence (σ1, …, σn) of its images of 1, …, n, then it is encoded by a sequence of n numbers, but not all such sequences are valid since every number must be used only once. By contrast the encodings considered here choose the first number from a set of n values, the next number from a fixed set of n − 1 values, and so forth decreasing the number of possibilities until the last number for which only a single fixed value is allowed; every sequence of numbers chosen from these sets encodes a single permutation. While several encodings can be defined, the Lehmer code has several additional useful properties; it is the sequence
L(\sigma)=(L(\sigma)_1,\ldots,L(\sigma)_n)\quad\text{where}\quad L(\sigma)_i=\#\{ j>i : \sigma_j<\sigma_i \},
in other words the term L(σ)i counts the number of terms in (σ1, …, σn) to the right of σi that are smaller than it, a number between 0 and ni, allowing for n + 1 − i different values.
A pair of indices (i,j) with i < j and σi > σj is called an inversion of σ, and L(σ)i counts the number of inversions (i,j) with i fixed and varying j. It follows that L(σ)1 + L(σ)2 + … + L(σ)n is the total number of inversions of σ, which is also the number of adjacent transpositions that are needed to transform the permutation into the identity permutation. Other properties of the Lehmer code include that the lexicographical order of the encodings of two permutations is the same as that of their sequences (σ1, …, σn), that any value 0 in the code represents a right-to-left minimum in the permutation (i.e., a σi smaller than any σj to its right), and a value ni at position i similarly signifies a right-to-left maximum, and that the Lehmer code of σ coincides with the factorial number system representation of its position in the list of permutations of n in lexicographical order (numbering the positions starting from 0).
Variations of this encoding can be obtained by counting inversions (i,j) for fixed j rather than fixed i, by counting inversions with a fixed smaller value σj rather than smaller index i, or by counting non-inversions rather than inversions; while this does not produce a fundamentally different type of encoding, some properties of the encoding will change correspondingly. In particular counting inversions with a fixed smaller value σj gives the inversion table of σ, which can be seen to be the Lehmer code of the inverse permutation.

Encoding and decoding

The usual way to prove that there are n! different permutations of n objects is to observe that the first object can be chosen in n different ways, the next object in n − 1 different ways (because choosing the same number as the first is forbidden), the next in n − 2 different ways (because there are now 2 forbidden values), and so forth. Translating this freedom of choice at each step into a number, one obtains an encoding algorithm, one that finds the Lehmer code of a given permutation. One need not suppose the objects permuted to be numbers, but one needs a total ordering of the set of objects. Since the code numbers are to start from 0, the appropriate number to encode each object σi by is the number of objects that were available at that point (so they do not occur before position i), but which are smaller than the object σi actually chosen. (Inevitably such objects must appear at some position j > i, and (i,j) will be an inversion, which shows that this number is indeed L(σ)i.)
This number to encode each object can be found by direct counting, in several ways (directly counting inversions, or correcting the total number of objects smaller than a given one, which is its sequence number starting from 0 in the set, by those that are unavailable at its position). Another method which is in-place, but not really more efficient, is to start with the permutation of {0, 1, … n − 1} obtained by representing each object by its mentioned sequence number, and then for each entry x, in order from left to right, correct the items to its right by subtracting 1 from all entries (still) greater than x (to reflect the fact that the object corresponding to x is no longer available). Concretely a Lehmer code for the permutation B,F,A,G,D,E,C of letters, ordered alphabetically, would first give the list of sequence numbers 1,5,0,6,3,4,2, which is successively transformed
 \begin{matrix}
  \mathbf1&5&0&6&3&4&2\\
  1&\mathbf4&0&5&2&3&1\\
  1&4&\mathbf0&4&2&3&1\\
  1&4&0&\mathbf3&1&2&0\\
  1&4&0&3&\mathbf1&2&0\\
  1&4&0&3&1&\mathbf1&0\\
  1&4&0&3&1&1&\mathbf0\\
\end{matrix}
where the final line is the Lehmer code (at each line one subtracts 1 from the larger entries to the right of the boldface element to form the next line).
For decoding a Lehmer code into a permutation of a given set, the latter procedure may be reversed: for each entry x, in order from right to left, correct the items to its right by adding 1 to all those (currently) greater than or equal to x; finally interpret the resulting permutation of {0, 1, … n − 1} as sequence numbers (which amounts to adding 1 to each entry if a permutation of {1, 2, … n} is sought). Alternatively the entries of the Lehmer code can be processed from left to right, and interpreted as a number determining the next choice of an element as indicated above; this requires maintaining a list of available elements, from which each chosen element is removed. In the example this would mean choosing element 1 from {A,B,C,D,E,F,G} (which is B) then element 4 from {A,C,D,E,F,G} (which is F), then element 0 from {A,C,D,E,G} (giving A) and so on, reconstructing the sequence B,F,A,G,D,E,C.

Applications to combinatorics and probabilities

Independence of relative ranks

The Lehmer code defines a bijection from the symmetric group Sn to the Cartesian product [n]\times[n-1]\times\cdots\times[2]\times[1], where [k] designates the k-element set \{0,1,\ldots,k-1\}. As a consequence, under the uniform law on the Sn, the component L(σ)i defines a uniformly distributed random variable on [n + 1 − i], and these random variables are mutually independent, because they are projections on different factors of a Cartesian product.

Number of right-to-left minima and maxima

Definition : In a sequence u=(uk)1≤k≤n, there is right-to-left minimum (resp. maximum) at rank k if uk is strictly smaller (resp. strictly bigger) than each element ui with i>k, i.e., to its right.
Let B(k) (resp. H(k)) be the event "there is right-to-left minimum (resp. maximum) at rank k", i.e. B(k) is the set of the permutations \scriptstyle\ \mathfrak{S}_n\ which exhibit a right-to-left minimum (resp. maximum) at rank k. We clearly have
\{\omega\in B(k)\}\Leftrightarrow\{L(k,\omega)=1\}\quad\text{and}\quad\{\omega\in H(k)\}\Leftrightarrow\{L(k,\omega)=k\}.
Thus the number Nb(ω) (resp. Nh(ω)) of right-to-left minimum (resp. maximum) for the permutation ω can be written as a sum of independent Bernoulli random variables each with a respective parameter of 1/k :
N_b(\omega)=\sum_{1\le k\le n}\ 1\!\!1_{B(k)}\quad\text{and}\quad N_b(\omega)=\sum_{1\le k\le n}\ 1\!\!1_{H(k)}.
Indeed, as L(k) follows the uniform law on \scriptstyle\ [\![1,k]\!],\
\mathbb{P}(B(k))=\mathbb{P}(L(k)=1)=\mathbb{P}(H(k))=\mathbb{P}(L(k)=k)=\tfrac1k.
The generating function for the Bernoulli random variable 1\!\!1_{B(k)} is
G_k(s)=\frac{k-1+s}k,
therefore the generating function of Nb is
G(s)=\prod_{k=1}^nG_k(s)\ =\ \frac{(s)_{\uparrow n}}{n!},
which allow us to find again the product form for the generative series of the Stirling numbers of the first kind (unsigned).

The secretary problem

This is an optimal stop problem, a classic in decision theory, statistics and applied probabilities, where a random permutation is gradually revealed through the first elements of its Lehmer code, and where the goal is to stop exactly at the element k such as σ(k)=n, whereas the only available information (the k first values of the Lehmer code) is not sufficient to compute σ(k).
In less mathematical words : a series of n applicants are interviewed one after the other. The interviewer must hire the best applicant, but must make his decision (“Hire” or “Not hire”) on the spot, without interviewing the next applicant ( and a fortiori without interviewing all applicants).
The interviewer thus knows the rank of the kth applicant, therefore, at the moment of making his kth decision, the interviewer knows only the k first elements of the Lehmer code whereas he would need to know all of them to make a well informed decision. To determine the optimal strategies (i.e. the strategy maximizing the probability of a win), the statistical properties of the Lehmer code are crucial.
Allegedly, Johannes Kepler clearly exposed this secretary problem to a friend of his at a time when he was trying to make up his mind and choose one out eleven prospective brides as his second wife. His first marriage had been an unhappy one, having been arranged without himself being consulted, and he was thus very concerned that he could reach the right decision.