Tally method to build a machine (on paper, Turing Machine

219 Views Asked by At

Consider function $q$: For any even integer $x\ge0$ (including $0$): $q(x) = 4x$

I want to design a machine (on paper of course) to compute q under the Tally system. Another restriction is that when the input is odd number, the machine should not halt.

I decided to put this into programming (C++) then conclude the logic there, but the machine can not have any while loops, however; the machine can go to left right and write 0 or 1 on the paper. The paper is basically an infinite tape with boxes, each box is counted as one place that can hold one value $(x, 0, 1)$.

Any one knows how to solve this problem or possibly give me a suggestion to put me on right track?

1

There are 1 best solutions below

0
On BEST ANSWER

First, you must choose a method of read input.

For example: in low level Turing Machine(DTM), you can choose unary method of read input, for example if 11111 is written on tape of DTM it means number 5 and 11 for 2.

Second, you must choose a method of write output.

For example: In end of your program, every thing written in your tape of DTM(in unary method) it means your output(in unary method).

Now, write this program:

if number is odd
   loop forever
else
   read one '1' of tape and change it to 'A' and go to end of tape and write '111' after '#' 
   go back
   if do not find any '1' befor of 'A'
       remove '#'
       change all of the 'A' to '1'