Suppose you have a Turing machine T that computes the additi
Suppose you have a Turing machine T that computes the addition function for binary integers. So T computes f(n,m) = n+m.
Diagram and description of a TM M that computes the function g(n) = n2. I want to double check my answer.
Solution
We have T which adds two numbers. We have a tape and there are two numbers on it. Let us call them count and final result. We start with 0 and 0 for both of them. We will divide the task in to the following steps:
1) Increment the count on tape by 1.
2) Add the final result on tape with n and store it back on final result.
3) Compare the count on the tape with n. If they are not equal repeat step 1.
