Is binary divisibility by 3 determined by even and odd bit count?

In summary, the proof for the rule that if the number of even bits minus the number of odd bits is a multiple of 3, then the number is divisible by 3, can be found in modular arithmetic. This is a method of writing equations where the remainder after division is the only important factor. In the case of binary numbers, one can add or subtract any multiple of 10 and still get the same remainder. This is used in the proof to replace numbers with their equivalent remainder-wise.
  • #1
mpekatsoula
4
0
Well i found this sentence: "If the number of even bits minus the number of odd bits is a multiple of 3 (e.g. -3,0,3,6, etc) then the number is divisible by three." Can anyone tell me the proof of this?
Thanks
 
Mathematics news on Phys.org
  • #2
These rules can be found from modular arithmetic.
http://en.wikipedia.org/wiki/Modular_arithmetic

For binary number in particular we can write the following equation for a binary number where all equations are taking mod 3
[tex]
(a_n\dotsb a_3a_2a_1a_0)_b=2^n a_n+\dotsb+ 2^3 \cdot a_3+2^2\cdot a_2+2\cdot a_1+a_0=(-1)^n a_n+\dotsb+ (-1) \cdot a_3+(+1)\cdot a_2+(-1)\cdot a_1+a_0
[/tex]
Here you say that one has the alternatively add the bits and the final result will have the same divisibility by 3 as the complete binary number.

Have a look at Wikipedia and then ask, if something is unclear. I admit Wikipedia doesn't explain this well. Maybe you can also find a better reference.
 
  • #3
Hmm, couldn't find a very concise summary of modular arithmetic. Basically what you need to know is that one can write equations where one only cares if the remainder to some division is the same. For example
[tex]
9=19=29=\dotsb\qquad\text{mod 10}
[/tex]
since all numbers have the same remainder w.r.t. division by 10. Note that also
[tex]
9=-1=-11=\dotsb\qquad\text{mod 10}
[/tex]
since in general you can add or subtract any multiple of 10 (in this case).

Now some rule are, that for you can replace any integer by another which gives the same remainder. For example
[tex]
156=12\cdot 13=2\cdot 3=6\qquad\text{mod 10}
[/tex]
as you can check for yourself.

You can do this in equations also at any instant of the calculation
[tex]
1116=12\cdot (89+4)=2\cdot (9+4)=2\cdot 13=2\cdot 3=6\qquad\text{mod 10}
[/tex]
where in some steps I replaced number by their remainder w.r.t. division by 10 (which is basically the last digit of the number)

That what I did for your problem
[tex]
2^n=(-1)^n\qquad\text{mod 3}
[/tex]
where I replaced 2 with the "equivalent" remainder-wise -1.
 
  • #4
Well thanks for the help! First time in my life i hear about modular arithmetic! It took me some time to understand but thanks to your answer i think i got it!
 

Related to Is binary divisibility by 3 determined by even and odd bit count?

1. What is binary divisibility by 3?

Binary divisibility by 3 is a property of a binary number, meaning that the sum of its digits is divisible by 3. This is similar to the concept of divisibility by 3 in our base-10 number system, where the sum of the digits must be divisible by 3 for the number to be divisible by 3.

2. How can I determine if a binary number is divisible by 3?

To determine if a binary number is divisible by 3, you can add up all of its digits and check if the sum is divisible by 3. If the sum is divisible by 3, then the binary number is also divisible by 3.

3. Can a binary number be divisible by 3 if it has a decimal point?

No, a binary number with a decimal point cannot be divisible by 3. This is because the decimal point represents a fractional value, and it does not contribute to the sum of the digits in the binary number.

4. Are there any patterns in binary divisibility by 3?

Yes, there are patterns in binary divisibility by 3. For example, every other binary number is divisible by 3, starting with 3 (11 in binary), 6 (110 in binary), 9 (1001 in binary), and so on. Additionally, a binary number is divisible by 3 if the number of 1s in its binary representation is divisible by 3.

5. How is binary divisibility by 3 used in computer science?

Binary divisibility by 3 is often used in error detection and correction algorithms. By adding a parity bit (a 1 or 0) to a binary number to make it divisible by 3, errors can be detected and corrected if the sum of the digits is no longer divisible by 3.

Similar threads

  • Precalculus Mathematics Homework Help
Replies
7
Views
887
Replies
9
Views
2K
Replies
1
Views
2K
  • Precalculus Mathematics Homework Help
Replies
2
Views
1K
Replies
4
Views
1K
Replies
1
Views
850
  • General Math
Replies
2
Views
995
Replies
7
Views
3K
Replies
2
Views
667
Back
Top