2
$\begingroup$

What can be a good convention to represent positive and negative integers in unary notation on a Turing machine? I want to design a Turing machine which acts as a subtractor.So should I partition the integer range to represent positive and negative integers in unary notation or is there some other way?

$\endgroup$
1
$\begingroup$

A reasonable convention would be to take any enumeration of the integers and use it. For example, this enumeration $$ 0,1,-1,2,-2,3,-3,\ldots $$ corresponds to this encoding: $$ \begin{align*} 0 &\to \epsilon \\ 1 &\to 1 \\ -1 &\to 11 \\ 2 &\to 111 \\ -2 &\to 1111 \\ 3 &\to 11111 \\ -3 &\to 111111 \end{align*} $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.