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 "alpha"bet.

Examples

Conversion table:


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".

Python Conversion Code

def base36decode(input): CLIST="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" rv = pos = 0 charlist = list(input) charlist.reverse() for char in charlist: rv += CLIST.find(char) * 36**pos pos += 1 return rv

def base36encode(input): CLIST="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" rv = "" while input != 0: rv = CLIST [input % 36] + rv input /= 36 return rv

print base36decode("AQF8AA0006EH")print base36encode(1412823931503067241)

Uses in practice

The Remote Imaging Protocol for bulletin board systems used base 36 notation for transmitting coordinates in a compact form. Many URL redirection systems like TinyURL also use base 36 integers as compact alphanumeric identifiers. Various systems such as RickDate use base 36 as a compact representation of Gregorian dates in file names, using one digit each for the day and the month.

References

External links

* [http://www.wordwizard.com/phpbb3/viewtopic.php?f=16&t=17971 A discussion about the proper name for base 36] at the Wordwizard Clubhouse
* [http://primes.utm.edu/notes/words.html The Prime Lexicon] , a list of words that are prime numbers in base 36
* [http://www.tonymarston.net/php-mysql/converter.html A Binary-Octal-Decimal-Hexadecimal-Base36 converter] written in PHP
* [http://www.geocities.com/xulfrepus/folder/base.html A website that can convert numbers between bases from 2 to 36]


Wikimedia Foundation. 2010.

Look at other dictionaries:

  • base — base …   Dictionnaire des rimes

  • base — [ baz ] n. f. • XIIe; lat. basis, mot gr. « marche, point d appui » I ♦ A ♦ 1 ♦ Partie inférieure d un corps sur laquelle il porte, il repose. ⇒ appui (point d appui), assiette, assise, 1. dessous, fond, fondement, pied. La base de l édifice… …   Encyclopédie Universelle

  • Base D'or — En mathématiques, le nombre d or, à savoir peut être utilisé comme une base de numération. Ce système est connu sous le nom base d or, ou accessoirement, phinaire (car le symbole pour le nombre d or est la lettre grecque « phi »). Tout… …   Wikipédia en Français

  • base — n Base, basis, foundation, ground, groundwork are comparable when meaning something on which another thing is reared or built or by which it is supported or fixed in place. Base may be applied to the lowest part or bottom of something without… …   New Dictionary of Synonyms

  • base — base·ball; base; base·less; base·lin·er; base·ly; base·man; base·ment; base·ness; de·base; de·base·ment; di·a·base; em·base; gnatho·base; gyno·base; im·base; iso·base; phal·lo·base; rheo·base; rim·base; scle·ro·base; sub·base; sur·base;… …   English syllables

  • base — base1 [bās] n. [ME < OFr bas < L basis,BASIS] 1. the thing or part on which something rests; lowest part or bottom; foundation 2. the fundamental or main part, as of a plan, organization, system, theory, etc. 3. the principal or essential… …   English World dictionary

  • Base — (b[=a]s), a. [OE. bass, F. bas, low, fr. LL. bassus thick, fat, short, humble; cf. L. Bassus, a proper name, and W. bas shallow. Cf. {Bass} a part in music.] 1. Of little, or less than the usual, height; of low growth; as, base shrubs. [Archaic]… …   The Collaborative International Dictionary of English

  • Base — or BASE may refer to:A base is a mixture of urine n waste so do not eat it* Base meaning bottom, the lowest part of an object* can mean negative, unfavorable or undesirable in nature. Bad; vile; malicious; evil.In mathematics: *Base (mathematics) …   Wikipedia

  • base — 1. a base de. Locución preposicional que, seguida de un sustantivo, expresa que lo denotado por este es el fundamento o componente principal: «Los [tallarines] verdes [...] están hechos a base de albahaca» (Cisneros Mestizaje [Perú 1995]).… …   Diccionario panhispánico de dudas

  • base — (Del lat. basis, y este del gr. βάσις). 1. f. Fundamento o apoyo principal de algo. 2. Conjunto de personas representadas por un mandatario, delegado o portavoz suyo. U. m. en pl.) 3. Lugar donde se concentra personal y equipo, para, partiendo de …   Diccionario de la lengua española

  • Base — Base, n. [F. base, L. basis, fr. Gr. ba sis a stepping, step, a base, pedestal, fr. bai nein to go, step, akin to E. come. Cf. {Basis}, and see {Come}.] 1. The bottom of anything, considered as its support, or that on which something rests for… …   The Collaborative International Dictionary of English


Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”

We are using cookies for the best presentation of our site. Continuing to use this site, you agree with this.