Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the function f from N to N, where f(x) = [x/2]. (Here [x/2] is the larg

ID: 3707513 • Letter: C

Question

Consider the function f from N to N, where f(x) = [x/2]. (Here [x/2] is the largest natural number ? x/2 (thus, [4/2] = 2, [5/2]=2, [6/2]=3, etc). Construct a Turing machine using unary notation that computes the function. (Construct your machine without relying on marker symbols; that is, the machine’s tape alphabet, comprising all the symbols used by your machine, should be {1, B}.) Show, by describing appropriate configurations, how your machine computes f(3).

(Give a formal definition of your machine, but also give a brief explanation in English of how your machine works.)

Explanation / Answer

Programmatically this fucntion can be written like this :

int functionFromNtoN(int x) {

int ans = x >> 1; // right shift operator divides a number by 2;

return ans;

}