# Turing Machine divisible by 3

By Prof. Fazal Rehman Shamil

Turing Machine to Checks that a binary number is divisible by 3 or not?

A number is divisible by 3 if the sum of its all digits is a multiple of 3 or divisibility by 3.

Multiple of 3:  Any number that three divides evenly or any number for which 3 is a factor. For a number to be divided “evenly” by three the answer must be a whole number with no remainders. So, 30 is a multiple of 3 since 30 / 3 = 10 (10 is a whole number), but 31 is not because 31 / 3 = 10.33

The divisibility rule for 3 states that a number is completely divisible by 3 if the sum of its digits is divisible by 3.

Consider a number, 204. To check whether 204 is divisible by 3 or not, take sum of the digits (i.e. 2+0+4= 6). Now check whether the sum is divisible by 3 or not. If the sum is a multiple of 3, then the original number is also divisible by 3. Here, since 6 is divisible by 3, So 204 is also divisible by 3.

Just for practice

Similarly, if you can test that 204 is divisible for other numbers or not.

divisible by 2
Yes
divisible by 3
Yes
divisible by 4
Yes
divisible by 5
No
divisible by 6
Yes
divisible by 7
No
divisible by 8
No
divisible by 9
No
divisible by 10
No
divisible by 11
No
divisible by 12
Yes
divisible by 13
No

Turing Machine divisible by 3Note:

• 1->1->R and 1->R are same things. Both represent read 1, write 1, and move right.
• [ and Delta and empty cell of tape are the same things

Turing machine that checks if the input length is divisible by 3.

## Turing Machine divisible by 3 with animations Prof.Fazal Rehman Shamil (Available for Professional Discussions)