The Answer Archive
Providing students and professionals with answers to their toughest software, technology, math, and science problems. Browse the Archive!
Search Questions and Answers:

Show only unanswered questions

Duotrigesimal (Base 32) Numbers

Posted by admin on 07 Jul 2007 at 12:00 AM
$5.00

Math and Statistics / Trionometry

Dear ,

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

Accepted Answer:

Answer provided by admin on 07 Jul 2007 at 12:00 AM

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.

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

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:

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

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.

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?

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

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!

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

Rating: * * * * *      Awarded: $5.00
Ask a Question
Most Recent Questions
Most Recent Answers
Home Page

Login
Register

Information Technology
Software, Hardware, Design

Programming Languages
Database
Graphic Design
Operating Platforms
Hardware and Networking

Math and Science
Homework Help

Biology and Geology
Math and Statistics
- Algebra I
- Algebra II
- Basic Arithmetic
- Boolean Algebra
- Calculus I
- Calculus II
- Combinatorics
- Differential Equations
- Geometry
- Linear Algebra
- Logic
- Multi-Variable Calculus
- Pre-algebra
- Probability
- Statistics
- Trionometry
Chemistry
Physics
Engineering

Are you an information
technology or
math/science expert?

You can earn money by
providing answers to questions
at AnswerArchive.com.
Learn How

Browse Archive | Ask a Question | Most Recent Questions | Most Recent Answers | Home Page | Contact Us | Help
(c) 2008 The Answer Archive