9/11/17

Algorithm PD

Let base P is a smaller than divisor D.
The conversion add P+(D-P) from base P into base D gets the remainder from division into least significant digit. These conversion decreases current digit by multiplication a difference R=D-P with previous digit. Then we cut the least significant number off and reconvert to base P. These algorithms are inverse, but there is one unpaired step in the middle during division.
The first conversion algorithm is publicized in special case R=2 in MJM on June 2014 Conversion of number systems and factorization [pdf]. The second has negate R.

This step can be expressed as follow:
do from most significant digit
  add (- R*this) to next digit / number
until we take the least significant one; 

Example in decimal system:
358 / 12
multiply by 12-10=2 each numbers, they we get from digit of number. The last is the remainder from division. 
        3
-2*   3+5 = -1
-2*(-1)+8 = 10

This method allows get quotient, but ones must be very cautious, verify all changes of digits and repair becoming list of numbers.
In this example we got list [3, -1, 10] in decimal, which is translated into
3*10-1 with remainder 10, so quotient is 29.