The solution uses an additonal row to transform the binary number. A single one is written on the additional row in the beginning.
Steps:
- Read current bit of the binary number.
- If the bit read is a one, go to step 3, otherwise go to step 4,
- Copy the ones in the help row to the end of the output (blue states).
- Double the ones in the help row (green states)
- Go to the next bit of the binary number. Return to step 1 if there is a bit left.
