« The cat is out of the bag... | Main| The news today...IBM has announced their plans to integrate Sametime with Office, Outlook and Sharepoint. »

No one up for the challenge?

Category
I think this entry got lost with everyone travelling to Ireland, so I'll repost it, A Domino formula puzzler... basically create a formula that can convert base 16 to base 36. I'm beginning to think it might not be possible in the Domino formula language.

Comments

Gravatar Image1 - what too much time on your hands, even with soccer?

Gravatar Image2 - I know it can be done, but not by converting to a number and dividing by 36s to get the digits. You'll run into precision and/or overflow issues given that you said it has to deal with up to 32 hex chars.

I would approach it in four parts. First, I would convert the hex string to a string of "1"s and "0"s, representing the number a long binary string. That will be easy. No loop required.

The next part is to implement a binary string division algorithm. But this is the hard part. Hardware can do it, so obviously software can too. I'm sure there are plenty of textbook descriptions of the algorithm, in various machine languages.

The third part is a loop, successively applying the binary division algorithm to divide a binary string by "10010". You're working backwards, from the last digit to first. You start with your converted binary string as the dividend. On each iteration, you take the remainder, convert it to decimal and use it to index into an array of base 36 chars to get a char, and pre-pend that char to your answer. Take the quotient as your new dividend and repeat until your quotient gets to zero.

The third part is the algorithm to convert the remainder from a binary string to decimal. But that's a piece of cake. You're only dealing with values "00000" to "10010", so you might as well just create a list with the 36 possible values and use @member.

So, that's how someone can do it. But sorry... I don't have the time.

Gravatar Image3 - Ooops! That's two "third part"s. Clearly, the second third part is really the fourth part. But I didn't expect the Spanish Inquisition.

Gravatar Image4 - Yes it is possible, but there is not enough room in this tiny box for me to type it all in.

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::rolleyes:;-)