Construct a Turing Machine which calculates a binary number modulo another.

Initial condition

The two numbers are written beneath each other and are of the same length. The upper number should be calculated modulo the lower one. The read/write-head starts on the #-symbol in right upper corner.


possible task (46 modulo 13)

Final condition

The result of the operation should be written on the top row.

Hint

a modulo b (with a >= b) can be calculated as follows:
while(a >= b){
   a := a-b
}
return a