Question: Can someone please show how one would implement a Turing Machine that computes the following : F(x) = x^2 for all x 1. Some examples
Can someone please show how one would implement a Turing Machine that computes the following :
F(x) = x^2 for all x 1. Some examples of the input and output for this machine:
1. if input is B 1 1 B then output should be B 1 1 1 1 B
2. if input is B 1 1 1 B then output should be B 1 1 1 1 1 1 1 1 1 B
3. if input is B 1 1 1 1 B then output should be B 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 B
4. if input is B 1 B then output should be B 1 B
The machine should halt with the tape head reading the B immediately to the left of the output.
Hint: We can use these two codes (1st of two)
1,B,R,2
2,1,B,3
3,B,R,4
4,1,R,4
4,B,R,5
5,1,R,5
5,B,1,6
6,1,L,6
6,B,L,7
7,1,L,7
7,B,1,8
8,1,R,2
2,B,L,10
10,1,L,10
(2nd of 2)
1,B,R,2
2,1,R,2
2,B,R,12
12,1,B,13
13,B,R,14
14,1,R,14
14,B,R,15
15,1,R,15
15,B,1,16
16,1,L,16
16,B,L,17
17,1,L,17
17,B,1,18
18,1,R,12
12,B,L,20
20,1,L,20
20,B,L,21
21,1,L,21
21,B,R,22
22,1,B,23
23,B,R,24
24,1,1,2
24,B,R,25
25,1,B,26
26,B,R,25
We have to "splice" the above two codes together.
Thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
