Base 36
Encyclopedia : B : BA : BAS : Base 36
Base 36 is a positional numeral system using 36 as the radix. The choice of 36 is convenient in that the digits can be represented using the Arabic numerals 0-9 and the Latin letters A-Z. Base 36 is therefore the most compact case-insensitive alphanumeric numeral system using ASCII characters, although its radix economy is poor. (Compare with base 16 and base 64.)
From a mathematical viewpoint, 36 is a convenient choice for a base in that it is divisible by both 2 and 3, and by their multiples 4, 6, 9, 12 and 18. Each base 36 digit can be represented as two base 6 digits.
The most common latinate name for base 36 seems to be hexatridecimal, although sexatrigesimal would arguably be more correct. The intermediate form hexatrigesimal is also sometimes used. For more background on this naming confusion, see the entry for hexadecimal. Another name occasionally seen for base 36 is alphadecimal, a neologism coined based on the fact that the system uses the decimal digits and the letters of the Latin alphabet.
Examples
Conversion table:
| Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Base 36 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | G | H |
| Decimal | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
| Base 36 | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
Some numbers in decimal and base 36:
|
|
|
Conversion
32- and 64-bit integers will only hold up to 6 or 12 base-36 digits, respectively. For numbers with more digits, one can use the functions mpz_set_str and mpz_get_str in the GMP arbitrary-precision math library. For floating-point numbers the corresponding functions are called mpf_set_str and mpf_get_str.
Uses in practice
The Remote Imaging Protocol for bulletin board systems used base 36 notation for transmitting co-ordinates in a compact form. Many URL redirection systems like TinyURL also use base 36 integers as compact alphanumeric identifiers. Various systems use base 36 as a compact representation of Gregorian dates in file names, using one digit each for the day and the month.
External links
- [A discussion about the proper name for base 36] at the Wordwizard Clubhouse
- [The Prime Lexicon], a list of words that are prime numbers in base 36
- [A Binary-Octal-Decimal-Hexadecimal-Base36 converter] written in PHP
- [A website that can convert numbers between bases from 2 to 36]
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.
