## How to prove unsolvable problem for Turinh machine? - turing-machines

Lets prove that problem cannot to be algorithmically solved: B(M) = 1, if M - Turing Machine program and there does not have any input for string length 2, 4, 6, 8, on which M stops
My idea is:
M = “On input string w:.
Scan the tape and mark the first 0 which has not been marked. If no unmarked 0 is found, go to stage 4. Otherwise, move the head back to the front of the tape.
Scan the tape and mark the first 1 which has not been marked. If no unmarked 1 is found, reject
Move the head back to the front of the tape and go to stage 1.
Move the head back to the front of the tape. Scan the tape to see if any unmarked 1s remain. If none are found, accept; otherwise, reject.”
After performing these algorithms if there is no strings for the relevant sizes given in question, then, it will come to default position and it will print a default output as 1.
But I am really not sure

## Related

### How to design a Turing machine which checks whether a number is prime or not?

I could only make out that the logic must have included the logic of multiplication and division in Turing machines . But actually I cannot make out the exact solution.

Well, if just any old TM will do, this one is easy to understand. input tape is #(n)# use a TM to write this to the tape: #(n):(2):(n)# use a TM to subtract whatever is in between the : from the thing after both : over and over until either (1) you have too few symbols to remove (not divisible) or (2) there are exactly zero symbols left (evenly divisible). In case of (1) continue, otherwise - in case of (2) - halt-reject as not prime. use a TM to write this to the tape: #(n):(m+1):(n)# use a TM to check wither the thing before the first : is greater than the thing in between the two :. If so, continue with step 3. Otherwise, halt-accept (since the original input cannot be divisible by a number greater than itself) Take all the TMs described and construct a single TM that incorporates all that behavior in various states. This is a TM for the language of prime numbers. Assuming a unary encoding (that is, the natural number n is represented by the string 11...1 where 1 is repeated n times), here's some more pointers on making the individual TMs: original input go to the first blank after the input and write a :. Then, go to the right and write 1. Then, go to the right and write another 1. Then go to the right and write another :. Then, bounce back and forth from the beginning to the first blank at the end, copying the input natural number's unary digits. To do this, update the input digits to some other symbol, like A, so you remember ones you already copied. Stop this process when there is an A immediately to the left of the first :. Then, set all the A back to 1. bouncing back and forth, remove a 1 from the rightmost section for each 1 in the innermost section, updating the innermost section to use A to mark them. Once everything in the innermost section is marked, set them back to 1, and repeat the process until you run out of 1s in the rightmost section . erase the second : and everything after it; then write a 1 at the end, then a :, and do what the TM described in 2 does. bounce back and forth between the leftmost and innermost sections, marking in each one as you go. If you run out of symbols in the innermost section first, the number is less than the input number; if you run out at the same time, the numbers are the same, meaning that the input number is first divisible by itself, so it's prime.

### Turing machine mod function

Can anyone explaine me how to do Turing machine for following: Y= X mod 3, where (X, Y) binary numbers with minimum time complexity 10

All right, you understand the algorithm, now we must build the machine. We will start with the number 111010 (58), reading from left to right, with the machine head starting at the left. There are two modes: scanning to the right to see what is there, and moving to the left while rewriting. | v x111010m abcdefgh (I have marked the positions a-h, for our conversation.) What should the machine do? In a Turing machine, a state has several rules, so that the machine can decide what to do by which symbol it sees. The rules for state A can look like: "If I see the symbol x, I will erase it and write the symbol v, move one step to the left and enter state B." "If I see the symbol y, I will leave it undisturbed, move one step to the right and enter state D." "If I see the symbol w, I will erase it and write the symbol z, move one step to the left end enter state A (remain in this state)." In general, it scans to the right, to discover whether the number begins with 11, 100 or 101. This involves two different states. It then moves to the left, rewriting 11->xx, 100->xx1, 101->x10. This involves several states. In the case of 111010, it the first few moves will look like this: (a) In state 1, read x, leave it undisturbed, move right, remain in state 1. (Looking for 1.) (b) In state 1, read 1, leave it undisturbed, move right, go to state 2. (What comes next?) (c) In state 2, read 1, write x, move left, go to state 3. (Must rewrite this symbol as x and the previous one as x.) (b) In state 3, read 1, write x, move right, go to state 1. (Looking for 1 again.) (If you are clever you can do without state 3, but let's get the machine working first.) So I can write some of the rules like this: 1 x x right 1 1 1 1 right 2 2 1 x left 3 3 1 x right 1 You must write enough rules that the machine always knows what to do, and if you want the machine to stop (yes!) there must be a rule -- or many rules -- like this: 5 m m right halt Is this enough to get you started?

I made it. Here is working machine)

### Construct a Turing-Machine to decide ww^Rw

w^R is the reverse of w and w is {0, 1}* . So the TM needs to decide a word followed by the reverse of this word followed by the word. I don't want the answer, I just want a lead to start and to get on the right track.

Since some time has passed and the answer probably isn't needed anymore, I guess I'll propose a solution for the benefit of future students looking for an example of how one language can be recognized by a Turing machine. Here's the idea. We'll take as the tape alphabet {0, 1, a, b, c, d} and make a single-tape singly-infinite tape Turing machine that recognizes w w^R w. The machine will work in five phases: Replace 0s and 1s in the prefix w w^R with a's and b's. See whether w w^R is a palindrome. Restore the tape to its pristine state. Replace 0s and 1s in the suffix w^R w with c's and d's. See whether w^R is a palindrome. Note that this is simply one easy (for me to understand, that is) way to show that there exists a Turing machine to recognize this language. Naturally, showing that there exists an algorithm to solve this in any Turing-equivalent system of computation is just as good (it proves there exists a TM)... still, this outlines the construction of one such TM. Also note that there may be a simpler, more efficient or more intuitive TM to solve this problem... again, this is only one approach. Step 1 will work as follows: Precondition: The tape begins with a blank, contains any string in (0+1)*, and is followed by an infinite string of blank squares. Postcondition: Halts if tape is empty or if length is not a multiple of 3; else, the tape begins with a blank, is followed by (a+b)^2n (c+d)^n, followed by an infinite string of blanks. Move to the right. If empty, halt accept. Otherwise, Scan to the right until you find an empty tape square, then move left. Change the tape to c if 0 or d if 1. Scan left until you find an empty tape square. Move right. If the tape is 0 or 1, change to a or b then move right. If the tape is c or d, halt reject. If the tape is 0 or 1, change to a or b then move right. If the tape is c or d, halt reject. If tape is c or d, scan to the beginning of the tape and go to Step 2. Otherwise, scan right until c or d, then move left. Change the tape to c if 0 or d if 1. Scan left until you find either a or b. Move right. Repeat starting at 4. Step 2 will work as follows: Precondition: The tape begins with a blank, is followed by (a+b)^2n (c+d)^n, followed by an infinite string of blanks. Postcondition: Halts if the prefix (a+b)^2n isn't a palindrome; otherwise, leaves the tape in a state like D (c+d)^3n D* Move right. If tape is a (or b), move right. If tape is c or d, go to the beginning of the tape, then go to Step 3. If the tape is c, d or blank, halt reject. Otherwise, scan right until you find a c, d or blank. Move left. If the tape is a b (or a), halt reject. Otherwise, change this to a c (or d) and scan back to the left until you see a blank, a c or a d. Move right. Change a (or b) to c (or d). Move right. Repeat starting at step 2. Step 3 will work as follows Precondition: Tape is D (c+d)^3n D* Postcondition: Tape is D (0+1)^3n D* Move right. If tape is c, write 0 and move right. If tape is d, write 1 and move right. If tape is blank, move to first blank space at the end of tape and go to step 4. Repeat step 2. Step 4 and 5 work just like steps 1 and 2, except you work backwards (the tape now looks like D (c+d)^n (a+b)^2n D*, and you must check to see whether the (a+b)^2n part is a palindrome. Any string passing both these tests must be of the form w w^R w where w is in (0+1)*.

As a hint, note that wwRw must have length 3n for some n (since each character appears exactly three times). You might therefore build a Turing machine that works by somehow counting the length of the string, using this to determine where the boundaries of the three strings are, and then checking that the three pieces all have the appropriate composition. If you can't count up a multiple of 3 characters, you could immediately reject. Depending on what sort of TM is allowed, this might be easiest with a multitrack or multitape Turing machine so that you can mark up the letters with some extra information. Hope this helps!

### Turing machine diagram for enumerator

I am supposed to draw an enumerator for the language 0^k1^k (k>=0). I am not sure how that is different from building a Turing machine state diagram for this language: the way I understand it is that I need to build an enumerator that recognizes the aforementioned language given all strings above {0,1} by simulating the Turing machine that recognizes this language on string i for i steps, which I couldn't think how to do using a state diagram, but my teacher has pointed out that this is how we prove the equivalence between an enumerator and a Turing machine, so I thought that what we have to do is use the transition function defined for enumerators which makes the diagram look similar to the Turing machine that recognizes 0^k1^k, only instead of moving to qaccept we move to qprint for inputs in the language, and then for inputs that must be rejected we print epsilon? But how do we go about producing an infinite number of strings above the alphabet {0,1}? At the initial state the work tape and the print tape are empty. Can someone clarify these points for me? Maybe I misunderstand.

I think I finally have the enumerator notion clear, an enumerator is not supposed to read an input, it creates words in the language for which it is built: here's the algorithm: print epsilon on the output tape write 01 on the work tape go back to the front of the tape and copy its contents to the output tape go back to the leftmost 0, replace it with 1, go to the rightmost 1 and add two 1's at the end. go back to stage 3

i thought of another slightly different algorithm that produces a smaller number of states, and uses only {0,blank} on its work tape:

i think you might have an error there. in stage 4, you wrote "go back to the leftmost 0, replace it with 1, go to the rightmost 1 and add two 1's at the end" i think it should be: "go back to the leftmost 1, replace it with 0, go to the rightmost 1 and add two 1's at the end"

### Graphing calculator logical test error

I tried making the following program and it worked fine at first. Label 1 Input "n=", Q If Q≤0 ...Then Goto 1 Else Label 2 ((Q-2int(Q/2))(3Q+1)+(1-Q+2int(Q/2))(Q/2))->Q Display Q If Q≠1 Then Goto 2 Else Goto 1 What this is supposed to do is I put in a starting number, and if its an even number, it does Q/2. if its odd, it does 3Q+1 and stores the result back into Q. This is the Collatz Conjecture, which states that if this iteration is followed through, no matter what number you start out with, it will always come down to 1. some starting numbers take more steps to reach while some take fewer steps. The problem: Sometimes after the program goes through a large number of iterations, it shows up ERROR, and when I press debug, it takes my cursor over the Q in if Q≠1. Do you know why this keeps happening? Thanks.

The hurdle that most people have to overcome when doing this puzzle is the overflow caused by huge numbers -- I think that it happens at a number somewhere around 23, IIRC. That might be the case, but I can't see why it would take your cursor over the Q.