×

# Inspiration for Binary and 3

Write a program to accomplish following task.

Your friend Jack enters bits of a binary number (unit bit then two's bit then four's bit then ...). He will terminate by entering a non binary digit (i. e. anything other than 0 and 1). Each time he enters digit, tell him whether number formed so far is divisible by 3 (i.e. $$11_2$$) or not.

Note by Rushi Jogdand
5 months, 3 weeks ago

Sort by:

Take the difference between sums of alternate digits. If it is 0 or is divisible by 3, then the number is divisible by 3. I'll let you think, why so? · 5 months, 1 week ago

Analogus to "divisibility test for $$11_{10}$$", isn't it? Can you solve this one and post your solution. · 5 months, 1 week ago

The question to which you have linked. Is $B$ fixed? Then, $S$ contains $\le n$ nunbers or did you mean all such $2^n$ numbers? · 5 months, 1 week ago