How to create a Turing machine that takes a decimal number with a number from 0 to 9 and displays a cube

I am working on a project for Turning Machine, but have problems with conceptualizing steps.

f(x) = x^3, where x is a single digit between 0 - 9 inclusive.

Based on my understanding, I have to convert the number to binary, but how to find the cube of the number in binary format.

Also, how to write a cube on a tape.

So far, I think I should create a state diagram that accepts binary versions 0-9, but what next?

+3
source share
1 answer

I would do it like this:

  • Write a copy of the number to the left of your current number
  • Write another copy to her left
  • Multiply the original number by the first copy, erasing the copy
  • Multiply the result by the second copy, erasing it

"" ( ) , . , ( ). , , , 0 9.

+2

Source: https://habr.com/ru/post/1741204/


All Articles