Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
_____________________________________________
Associated Topics || Dr. Math Home || Search Dr. Math
_____________________________________________

Duotrigesimal (Base 32) Numbers


Date: 06/11/99 at 08:17:55
From: Jan A. de Boer
Subject: Base 32 numbers, duotrigesimal

Dear Dr. Math,

By chance I read several of the base [any number] pages on your site. 
I would like to mention a problem we had in finding a condensed way of 
writing numbers.

In the financial software of our university we had to represent six-
digit customer project numbers in a four-position alphanumeric 
database field. The traditional way. by maintaining conversion tables 
with the numbers and their four position code, seemed cumbersome. I 
thought that increasing the base number sufficiently would result in 
four-position representations of decimal numbers up to 1000000. 
Clearly hexadecimal numbers (Greek hexa-kai-deka = 16) were not the 
answer, since FFFF represents decimal 65535. So I tried base 32. Each 
position in a number would have values from 0 up to 31, and four 
positions would result in 31*32^3 + 31*32^2 + 31*32 + 31, which is 
of course equivalent to 32^4 - 1 = decimal 1048575. That would do the 
trick.

I baptised these numbers "duotricesimal" (Latin duotriginta = 32). 
For the position values 0-9 one uses of course 0-9, and for 10-15 the 
hexadecimal notation A-F. For 16 and up we excluded the letters I and 
O to avoid mixups with 1 and 0. So following 0-9 we have in use:

     A 10   G 16   N 22   U 28
     B 11   H 17   P 23   V 29
     C 12   J 18   Q 24   W 30
     D 13   K 19   R 25   X 31
     E 14   L 20   S 26
     F 15   M 21   T 27

Next thing was to write short function procedures to convert decimal 
to duotricesimal and vice versa. Because base conversions are so 
simple, they turn out to be much faster than look-ups in conversion 
tables, and we avoided an extra table to maintain.

Best regards,
Jan A. de Boer
Office of the Faculty of Mathematics and Natural Sciences
University of Groningen, The Netherlands


Date: 06/11/99 at 13:03:06
From: Doctor Peterson
Subject: Re: Base 32 numbers, duotrigesimal

Hi, Jan. It's always nice to hear that the math we discuss has real 
uses!

I think the proper term would be "duotrigesimal"; there is a 
"vigesimal" system, the base 20 used by the Maya and others, and a 
"sexagesimal" (base 60) system used by the Babylonians, which suggest 
how to make such names from the Latin. But I didn't find any variant 
of your name mentioned anywhere on the Web. I've been told about some 
weird bases used in strange situations, but this is a first for 32.

I'm curious about several things. First, why did you have to fit a 
number into a four-character field? Is this a case, similar to the Y2K 
problem, of having to change ranges without affecting existing stuff, 
or is it simply that the database is not designed with flexibity in 
mind? Second, why did you stop at base 32, and not go all the way to 
base 36 using all the letters? If conversion to or from binary is 
important, I can easily see why you'd do this; otherwise, I suppose 
it's as much aesthetic as anything.

Thanks for the information. Maybe we'll put together a list of 
"unusual bases in unusual places" someday.

- Doctor Peterson, The Math Forum
  http://mathforum.org/dr.math/   


Date: 06/14/99 at 04:28:01
From: Jan Allerd de Boer
Subject: Re: Base 32 numbers, duotrigesimal

Dear Dr. Peterson,

Yes thanks, I think duotrigesimal is like the word the Romans would 
have used. I will change our documentation and use duotrigesimal.

>I'm curious about several things. First, why did you have to fit a 
>number into a four character field? Is this a case, similar to the 
>Y2K problem, of having to change ranges without affecting existing 
>stuff, or is it simply that the database is not designed with 
>flexibity in mind?

It is the everlasting story of practical limitations. The University's 
financial department is not keen on introducing peculiarities in the 
software it bought from BaaN. Everything is flexible, but changing 
table structures has a high price that is billed again if a software 
upgrade is implemented. So "below" the level of faculty projects that 
act as supplier we only have that table with a four character key 
(indexed, very important) to store customer project numbers. Other 
fields of the table are non-indexed character fields for descriptions, 
not involved in the referential integrity of the database. We 
negotiated changing the key to six characters but we lost.

>Second, why did you stop at base 32, and not go all the way to base 
>36 using all the letters? If conversion to or binary is important, I 
>can easily see why you'd do this; otherwise, I suppose it's as much 
>aesthetic as anything.

In the conversion function procedures we did not use the property of 
32 being a power of 2. So the choice seems aesthetic, but it is also 
instinctive. 

Considerations were:
First, 32 is the minimum base size that counts up to a million in four 
positions: 31^4 - 1 is only 923520. Second, I wanted to exclude 
letters I and O because of their resemblance with 1 and 0. So that 
would make only base 34 possible. Third, I am of the lazy type, fond 
of things one could use in another way. Base 32 might be handy for a 
binary problem (like base 8 and 16). Base 34 has no advantage there.

Best regards,
Jan de Boer


Date: 06/14/99 at 09:01:36
From: Doctor Peterson
Subject: Re: Base 32 numbers, duotrigesimal

Hi again, Jan -

Thanks for indulging my curiosity. It does sound as if you came up 
with a beautiful solution to your problem. The fact that 2^10 is close 
to 10^3, and therefore 32^4 = 2^20 is close to 10^6, is what made it 
work.

Incidentally, if you want to see one of my "weird bases", take a look 
here:

 http://mathforum.org/dr.math/problems/behymer8.20.98.html   

where someone actually uses base 48 as part of her job, and not for 
such pragmatic reasons as your base 32.

- Doctor Peterson, The Math Forum
  http://mathforum.org/dr.math/   


Date: 05/12/2000 at 14:28:03
From: Tomer
Subject: About Bases (64 & 85)

As a follow-up comment on your response about base32, I'd like to add 
two more bases that I know are being used in the computer world. The 
first is base 64, which is used when transferring files via e-mail in 
SMTP, the second is base 85 which is used in the notation of new IP 
addresses.

Thought you'd be interested to know.


Date: 05/12/2000 at 17:10:57
From: Doctor Peterson
Subject: Re: About Bases (64 & 85)

Hi, Tomer.

Thanks for adding to my collection. I looked for some good references 
to these two applications and found "A Compact Representation of IPv6 
Addresses" at:

   http://www.landfield.com/rfcs/rfc1924.html   

but nothing yet that gives details on SMTP MIME base 64 encoding, 
though I found some references to it. Do you have a good source I can 
add to my list?

- Doctor Peterson, The Math Forum
  http://mathforum.org/dr.math/   


Date: 05/13/2000 at 11:51:36
From: Levinboim Family
Subject: Re: About Bases (64 & 85)

Try "Mechanisms for Specifying and Describing the Format of Internet 
Message Bodies " at this URL:

   http://www.ietf.org/rfc/rfc1341.txt   

in Section 5.2


Date: 05/13/2000 at 20:11:06
From: Doctor Peterson
Subject: Re: About Bases (64 & 85)

Hi, again.

Thanks. If you run across any other odd uses of bases (especially outside 
the computer world, where bases are familiar), let me know!

- Doctor Peterson, The Math Forum
  http://mathforum.org/dr.math/   


Date: 07/13/2001 at 21:35:37
From: Sean Riddle
Subject: More bases used in the "real world"

I've got a couple more bases that I've run into in the "real world."
They are both computer uses, though.

I bought an EPROM programmer many years ago (EPP-1 from Applied 
Reader Technology in Holland) that used a format called "four packed 
code."  The manual wasn't too informative, and there was no example 
of its use, but the idea was that 85^5 is very close to 256^4, so five 
printable characters can represent 4 bytes.  This is more efficient 
than using the ASCII representation of the binary data, which takes 
two printable characters for each byte.

WorldCom uses base 36 in filenames. That lets them use 1 character for 
the day of the month. This is important since their filenames are 
restricted to 8 characters with a 3-character extension. They also use 
base 36 in the extension as a sequence number. That lets us get 12 
files a day and not repeat a sequence number in 10 1/2 years.

Sean
    
Associated Topics:
High School About Math
High School Discrete Mathematics
High School Number Theory

Search the Dr. Math Library:


Find items containing (put spaces between keywords):
 
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

_____________________________________
Math Forum Home || Math Library || Quick Reference || Math Forum Search
_____________________________________

Ask Dr. MathTM
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/