COMMENTS:
Please note the following. Representation of a number in a system with base (radix) N may only consist of digits that are less than N.
More accurately, if
(1) | M = akNk+ak-1Nk-1+...+a1N1+a0 |
with 0 <= ai < n we have a representation of M in base N system and write
M = (akak-1...a0)N
If we rewrite (1) as
(2) | M = N*(ak+N*(ak-1+N*...))+a0 |
the algorithm for obtaining coefficients ai becomes more obvious. For example, a0=M modulo N and a1=(M/N) modulo N, and so on.
At one stage of conversion I use a built-in function parseInt which does not seem to return whenever this condition is violated by the very first digit. This appears to be a bug in the parseInt function. I am looking into this matter. For now, please follow the rule: