Question: Please answer the following question: Thank you, Create a Turing machine that does the following: The input will be two strings of a's, separated by
Please answer the following question: Thank you,

Create a Turing machine that does the following: The input will be two strings of a's, separated by a space, such as The strings represent two numbers, D and N, in "unary" notations. That is, the first string contains D a's and the second string contains N a's. Your goal is to test whether N is evenly divisible by D, or, equivalently, whether N is a multiple of D. If N is divisible by D, halt with output 1. If N is not divisible by D, halt with output 0. You can start the machine anywhere you find most convenient. (The left end of D is a reasonable choice.) As a hint, you can basically subtract D from N by erasing one a from N for each a in D. If you repeat that process over and over, you will eventually run out of a's in the string on the right. If that happens at the end of erasing a group of a's, then N was divisible by D. If it happens in the middle of erasing a group of a's, then N was not divisible by D. This is a challenging problem! Do some planning before you start. Ask for help and advice. I was able to do it with a Turing Machine that has 12 states (plus the halt state). Create a Turing machine that does the following: The input will be two strings of a's, separated by a space, such as The strings represent two numbers, D and N, in "unary" notations. That is, the first string contains D a's and the second string contains N a's. Your goal is to test whether N is evenly divisible by D, or, equivalently, whether N is a multiple of D. If N is divisible by D, halt with output 1. If N is not divisible by D, halt with output 0. You can start the machine anywhere you find most convenient. (The left end of D is a reasonable choice.) As a hint, you can basically subtract D from N by erasing one a from N for each a in D. If you repeat that process over and over, you will eventually run out of a's in the string on the right. If that happens at the end of erasing a group of a's, then N was divisible by D. If it happens in the middle of erasing a group of a's, then N was not divisible by D. This is a challenging problem! Do some planning before you start. Ask for help and advice. I was able to do it with a Turing Machine that has 12 states (plus the halt state)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
