image
Physics Forums Logo
image
image
* Register * Upgrade Blogs Library Staff Rules Mark Forums Read
image
image   image
image

Go Back   Physics Forums > Mathematics > General Math


Reply

image Binary divisibility by 3 Share It Thread Tools Search this Thread image
Old Nov5-09, 11:44 AM                  #1
mpekatsoula

mpekatsoula is Offline:
Posts: 4
Binary divisibility by 3

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
  Reply With Quote
Old Nov5-09, 01:11 PM                  #2
Gerenuk

Gerenuk is Offline:
Posts: 438
Re: Binary divisibility by 3

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
LaTeX Code: <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.
  Reply With Quote
Old Nov5-09, 01:22 PM                  #3
Gerenuk

Gerenuk is Offline:
Posts: 438
Re: Binary divisibility by 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
LaTeX Code: <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
LaTeX Code: <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
LaTeX Code: <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
LaTeX Code: <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
LaTeX Code: <BR>2^n=(-1)^n\\qquad\\text{mod 3}<BR>
where I replaced 2 with the "equivalent" remainder-wise -1.
  Reply With Quote
Old Nov5-09, 02:11 PM                  #4
mpekatsoula

mpekatsoula is Offline:
Posts: 4
Re: Binary divisibility by 3

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!
  Reply With Quote
image image
Reply
Thread Tools


Similar Threads for: Binary divisibility by 3
Thread Thread Starter Forum Replies Last Post
divisibility margot Number Theory 1 Oct28-09 01:22 AM
Divisibility Detektyw Precalculus Mathematics 8 Oct26-09 10:33 PM
Divisibility durt Calculus & Beyond 4 Jul6-08 07:53 PM
divisibility of n by 6 ToastMonger Number Theory 10 Dec30-07 07:11 PM
divisibility viren_t2005 Calculus & Beyond 1 Nov30-05 02:25 AM

Powered by vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. © 2009 Physics Forums
Sciam | physorgPhysorg.com Science News Partner
image
image   image