On Wed, May 6, 2009 at 11:42 PM, Todd Benson <caduceass / gmail.com> wrote:
> On Wed, May 6, 2009 at 11:32 AM, Martin DeMello <martindemello / gmail.com>rote:
>>
>>> out = ""
>>> while n > 0
>>>  
>>>   >>>   
>>> end
>
> Isn't that just a simple cipher (i.e. map)?     > something.     ɧ    嶴   > base62 is, except for that paper written in a scientific journal that
> I don't have access to (but, for the summary, of course).   > that is what the OP wanted anyway.

No, it's a number base transformation. Here's an example using base 7
(as being easier to work with than 62 :)):

letting n = 1250, and using # as a divmod operator:

1250 #  7 = 178, 4
178 # 7 = 25, 3
25 # 7 = 3, 4
3 # 7 = 0, 3  <-- we have reached n=0, so the loop terminates

so 1250[base 10] = 3434 [base 7]

If you think about it, base 10 works the same way:

1250 # 10 = 125, 0
125 # 10 = 12, 5
12 # 10 = 1, 2
1 # 10 = 0, 1

so 1250[base 10] = 1250[base 10]

To go the other way, you repeatedly add the least significant digit
and multiply by the base

so 3434[7]

start with 0, and read the digits in forward order
(0 * 7) + 3 = 3
3 * 7 + 4 = 25
24 * 7 + 3 = 178
178 * 7 + 4 = 1250 <--- et voila!

martin


martin