Exercise 7 of Set 1 -- Hint


Think about what happens to the base 10 value of a binary number each time you add another digit on the right. For example, if you begin with the binary number

101

representing the number 5, and the next character to be read is a 0, then the binary number read so far is

1010

which represents the number 10. Could you start with the knowlege that you had 5, and added a 0 on the end to get a 10? Is the result divisible by 5? If instead the next character to be read was a 1, then the binary number becomes

1011

which represents the number 11. Could you start with the knowlege that you had 5, and added a 1 on the end to get a 11? Is the result divisible by 5 this time?