Click

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.
Input: | a natural number a and a natural number b greater than 1 |
---|---|

Output: | The digits r,
_{0}r, _{1}r,...,_{2}r of the base
_{n}b representation of a |

such that
a = r.
_{n}⋅b^{n} +... + r_{2}⋅b^{2} + r_{1}⋅b + r_{0} |

*let***i****:= (-1)***let***q****:=****a***repeat**let***i****:=****i****+ 1***let***r**_{i}**:=****q****mod****b***let***q****:=****q****div****b**

*until***q****= 0***return***r**_{0},...,r_{i}