Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Math Topics » alt.math.recreational.independent

Topic: Converting ~50 significant digits base to base
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Mark G. Meyers

Posts: 8
From: Fairlee, VT
Registered: 3/20/10
Converting ~50 significant digits base to base
Posted: Dec 11, 2010 2:15 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I have made a protocol for "random deal codes" (playing cards), which are in base 36 (numerals and letters). I have a deck with 64 cards, 16 ranks, which requires 46 digits base 36, or 71 digits base 10 to put its entire arrangement into a single code. (This is part of the game culture, and less digits can be used, typed in, or worked with)

I have a problem with how to convert these numbers in computer programming, because they aren't numbers anymore - no processor I know of keeps 71 significant digits. So I am trying to chase this thing byte-by-byte.

I start with a 46-character string (non-math). I can grab bytes off of it. I can grab the first one and put it in a number variable, and then grab the next digit and multiply it by 36 and add it in.

Next, I can pull out a digit in base 64 (which I then need to do), and in the end an array of base 64 digits will give me everything I need. I'll use "base36" and "base64" as the names of the arrays of digits, with [] brackets for array indexes (starting at index 1 = least significant). "Buffer" will be a number field for doing math-work in.

Perhaps I am approaching this in an impossible way (above)? After putting base36[1] + base36[2]*36 into a number ("buffer"), and then producing base64[1] by dividing by 64 to pull a base 64 digit out, then I want to go back to get another base 36 digit. The problem is that I don't know what to multiply it by (it doesn't seem to be 36 again) to add it into the buffer at that point.

I can work with the base36[] number digit-by-digit, and I would like to produce base64[] as an array of digits. Can anyone help me to populate the array of base64 digits?


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.