Click New Example to start working through an example. Click on the steps of the algorithm to see the values of the variables in each step. First click on step 1. and then on the following steps in the order of execution.
New Example Restart Example
Algorithm. Conversion to base b representation.
Input:a natural number a and a natural number b greater than 1
Output:The digits r0, r1, r2,...,rn of the base b representation of a
such that a = rn⋅bn +... + r2⋅b2 + r1⋅b + r0.
  1. let i := (-1)
  2. let q := a
  3. repeat
    1. let i := i + 1
    2. let ri := q mod b
    3. let q := q div b
  4. until q = 0
  5. return r0,...,ri