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. ) or not.
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i-1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
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?
Log in to reply
Analogus to "divisibility test for 1110", isn't it? Can you solve this one and post your solution.
Log in to reply
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?
Log in to reply