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

mpekatsoula
Messages
4
Reaction score
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
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
<br /> (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<br />
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.
 
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
<br /> 9=19=29=\dotsb\qquad\text{mod 10}<br />
since all numbers have the same remainder w.r.t. division by 10. Note that also
<br /> 9=-1=-11=\dotsb\qquad\text{mod 10}<br />
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
<br /> 156=12\cdot 13=2\cdot 3=6\qquad\text{mod 10}<br />
as you can check for yourself.

You can do this in equations also at any instant of the calculation
<br /> 1116=12\cdot (89+4)=2\cdot (9+4)=2\cdot 13=2\cdot 3=6\qquad\text{mod 10}<br />
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
<br /> 2^n=(-1)^n\qquad\text{mod 3}<br />
where I replaced 2 with the "equivalent" remainder-wise -1.
 
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!
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
Thread 'Imaginary Pythagorus'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top