Hexavigesimal

Hexavigesimal

A Hexavigesimal numeral system has a base of twenty-six.

Base 26 is a fairly natural way of representing numbers as text using the 26-letter Latin alphabet. The number of interest is expressed in base 26, and then the 26 different base-26digits are identified with letters as 0=A, 1=B, 2=C, ... 25=Z. Some examples: 26 = BA, 678 = BAC.

This system is of limited practical value, although letters used in nominal or serial numbers can be thought as hexavigesimal numerals for calculation purposes if the entire alphabet is used.

Fractions

The fact that 26 is a composite number and lies between two composite numbers (25 and 27) leads to many simple fractions.

B/C = A.N B/D = A.IRIRIRIR... B/E = A.GN B/F = A.FFFFFFF...

The fractions B/G, B/I, B/J, B/K, B/M, B/N, B/P, B/Q are also simple.

Example Encoding Algorithm

This Java implementation shows how to convert base10 to base26. For the sake of simplicity "StringBuffer" or "StringBuilder" wasn't used. 97 is a magic number which refers to the ASCII code of the letter 'a' . Note that you can actually replace the 97 with 'a' in Java. However, it's not that easy with every language, hence the magic number, which should make porting a bit easier.public static String toBase26(int i){ String s=""; while(i>25){ int r=i%26; i=i/26; s=(char)(r+97)+s; } s=(char)(i+97)+s; return s;}

This code generates a, b, c, d, e ... z, then ba, bb, bc ... bz ... za, za, zb, zc ... zz, then baa, bab, etc. Since a is equal to 0, aaab, is the same as b. If you want the code to generate a, b, c ... z, then aa, ab, ac you need to subtract 1 from i=i/26.If you want to generate every possible combination of letters with the above algorithm:for (int i=0; i < Math.Pow(26, depth); i++) toBase26(i);

If you want to generate every possible combination of letters using the modification (i=i/26-1): int numPatterns = 0;

for (int i = depth; i > 0; i--) numPatterns += (int)Math.Pow(26, i);

for (int i = 0; i < numPatterns; i++) toBase26(i);


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • List of numbers — This is a list of articles about numbers ( not about numerals). Rational numbers Notable rational numbers Natural numbers * There is no consistent and widely accepted way to extend cardinals beyond centillion (centilliard). Proposed systematic… …   Wikipedia

  • List of mathematics articles (H) — NOTOC H H cobordism H derivative H index H infinity methods in control theory H relation H space H theorem H tree Haag s theorem Haagerup property Haaland equation Haar measure Haar wavelet Haboush s theorem Hackenbush Hadamard code Hadamard… …   Wikipedia

Share the article and excerpts

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