Ad
  • Custom User Avatar

    Given two set of digits (source and destination) and one string containg a "number" (this "number" can contain alphanumerical "digits"). Change the base or radix of this given "number" to other bases using the digits of the destination base.

    Example (Converting the number "hello" in base "allow" to base 10):

    In base "allow" we have the digits "a,b,c,d,...,z"; the "a" is the number 0 in base 10, meanwhile z is number 25 in base 10.

    We take the 'h' and multiply it decimal value by pow(25, 4). 25 is the base number (We only have 25 digits, and 4 is the "position" of the digit in the number)
    now with e, and l, and so on. Now we sum all the values of each digits and now we have a number in base 10, which is: 3276872

    Remember that each base uses different digits.