My Math Forum boolean and modulo

 Number Theory Number Theory Math Forum

 July 15th, 2010, 06:54 PM #1 Newbie   Joined: Jul 2010 Posts: 3 Thanks: 0 boolean and modulo Please do you know if (a&b)modp(where & stands for bitwise boolean AND operator)is the same as (amodp)&(bmodp)?Or can you direct me to somewhere i can find more information on this?Thanks.
 July 15th, 2010, 07:08 PM #2 Senior Member   Joined: Aug 2008 From: Blacksburg VA USA Posts: 344 Thanks: 6 Math Focus: primes of course Re: boolean and modulo ok, via wolframalpha, input box: (45 BitAnd 69) mod 4 returns 1 45mod4=1, 69mod4=1 1BitAnd1 gives 1, so on the first test check it worked. You may try others now ...
 July 16th, 2010, 07:18 AM #3 Senior Member   Joined: Apr 2010 Posts: 215 Thanks: 0 Re: boolean and modulo Your statement is valid if $p=2^n$ (for some natural integer n). Any other p will not work.
 July 16th, 2010, 03:18 PM #4 Senior Member   Joined: Feb 2009 From: Adelaide, Australia Posts: 1,519 Thanks: 3 Re: boolean and modulo If a and b are less than p, then the statements are equivalent, as a&b can't exceed min{a,b}. Otherwise (if p is not a power of 2) the situation is complicated. I have plotted results for (a,b) using modulo 3 and modulo 17. A white dot means equivalence, a black dot non-equivalence.
July 16th, 2010, 04:30 PM   #5
Senior Member

Joined: Apr 2010

Posts: 215
Thanks: 0

Re: boolean and modulo

Quote:
 Originally Posted by aswoods If a and b are less than p, then the statements are equivalent, as a&b can't exceed min{a,b}. Otherwise (if p is not a power of 2) the situation is complicated. I have plotted results for (a,b) using modulo 3 and modulo 17. A white dot means equivalence, a black dot non-equivalence.
Very nice patterns.

They are obviously symmetrical because the AND-operation is communitative:

(a&b)%p == (b&a)%p
(a%p)&(b%p) == (b%p)&(a%p)

 July 17th, 2010, 02:37 AM #6 Newbie   Joined: Jul 2010 Posts: 3 Thanks: 0 Re: boolean and modulo Thank you guys so much for replying.I feel so at home here on this forum.So many on point posts.I sorta suspected this about powers of two,but for the when a and b are less than p case that was a revelation.Thank you so much

 Tags boolean, modulo

,

### boolean algebra and modular arithmetic

Click on a term to search for related topics.
 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post Shamieh Applied Math 1 September 12th, 2013 06:09 PM rhymin Applied Math 0 April 17th, 2013 09:48 AM Hooman Abstract Algebra 1 December 18th, 2012 01:38 PM Anamaria Applied Math 1 February 18th, 2011 12:16 PM babypsycho Applied Math 13 March 28th, 2010 03:43 AM

 Contact - Home - Forums - Cryptocurrency Forum - Top