Develop a test for divisibility of a positive integer n by 8 based on the binary expansion of n.

Solution:Step 1:In this problem we have develop a test for divisibility of a positive integer n by 8 based on the binary expansion of n.Step 2: As we know that the binary form of 8 is 1000. So the divisibility rule applies on 1000 in decimal system also applies in binary.As we know the binary formation of any number is anan-1……...a2a1a0Therefore the divisibility test is if the binary form of the number is anan-1……...a2a1a0