4

I'm stuck on a problem I've been trying to solve, namely converting a binary number with no leading zeros to a unary representation on the same tape.

E.g. 110 -> xxxxxx

I found markov's algorithm as a potential solution, but am unable to implement it. Would appreciate some direction!

Edit: figured it out on my own. Write a machine for binary subtraction, then write an x for each subtraction.

Ahmed Jahan
  • 41
  • 1
  • 4

1 Answers1

0
1 q0:q1 0 R
1 q1:q1 1 R
0 q1:q1 0 R
  q1:qRev | L
| q1:q1 | R
0 q0:qCon # R
0 qCon:q00 0 R
1 qCon:q00 1 R
| qCon:! | S
0 q00:q00 0 R
1 q00:q00 1 R
| q00:q00 | R
  q00:qMul   L
|* qMul:qMul |* L
| qMul:qMul1 |* R
|* qMul1:qMul1 |* R
  qMul1:qMul |* L
1 qMul:qBea 1 R
0 qMul:qBea 0 R
|* qBea:qBea | R
  qBea:qRev   L
| qRev:qRev | L
1 qRev:qRev 1 L
0 qRev:qRev 0 L
# qRev:q0 # R
  qRev:q0   R