A Domino formula puzzler...
Category None
Remember my little programming challenge previously, well here's another one, which I intend to use and expand on as a cool technote for the blog if someone posts a good solution to this puzzle.
The challenge:
You have a field that contains a hexadecimal number, it could be a large hexadecimal number, lets say up to 32 characters long (you see where this is going?). Write an @formala that will convert the hexadecimal number to Base-36. Yep base 36. So where as base 16 (HEX) goes up to "F" Base 36 goes up to "Z", so for example the Hex Number 27 is 13 in base 36. Just to be complete, write the inverse formula that converts it back from Base-36 to Base-16 (HEX)
Have fun!
Remember my little programming challenge previously, well here's another one, which I intend to use and expand on as a cool technote for the blog if someone posts a good solution to this puzzle.
The challenge:
You have a field that contains a hexadecimal number, it could be a large hexadecimal number, lets say up to 32 characters long (you see where this is going?). Write an @formala that will convert the hexadecimal number to Base-36. Yep base 36. So where as base 16 (HEX) goes up to "F" Base 36 goes up to "Z", so for example the Hex Number 27 is 13 in base 36. Just to be complete, write the inverse formula that converts it back from Base-36 to Base-16 (HEX)
Have fun!
Comments
Too bad I don't have a Designer client installed. I just now tried to write a solution without documentation, but I couldn't remember enough @functions. Bah!
Posted by Damien Katz At 06:32:04 PM On 06/14/2006 | - Website - |
http://doc.notes.net/domino_notes/7.0/help7_designer.nsf
Posted by Carl At 08:03:01 PM On 06/14/2006 | - Website - |
This is not something that I want to burn a day on, but, I am curious as to how one would do such a task.
My thoughts were around automating the process of manual long division for the conversion, but, I was stuck on doing hex math maually. Then my attention whet elseware.
Maybe instead of doing the work in Lotus formula language, it could be done in Fabric?
Posted by Dwight Wilbanks At 12:48:19 PM On 06/21/2006 | - Website - |
Posted by Richard Schwartz At 07:58:47 AM On 06/22/2006 | - Website - |
REM {Hex to Num};
Num := 0;
@For(i:=1; i<=@length(Hex); i:=i+1;
Num := Num*16+@TextToNumber(@Replace(hex; "0":::"F"; "0":::"15"));
REM {"0":::"X" is a shorthand for "0":"1":"2":..."X"};
REM {Num to Base36};
Base36 := "";
@DoWhile(
m := @Modulo(Num; 36);
Base36 := @Replace(@Text(m); "0":::"36"; "0":::"Z") + Base36;
Num := @Integer(Num/36);
Num > 0);
Posted by Johannes At 02:31:22 AM On 06/24/2006 | - Website - |
Posted by John Foldager At 06:30:47 AM On 06/29/2006 | - Website - |