|
oxymoron
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
Those who seek perfection will only find imperfection
nils illegitimus carborundum
me, me, me
me, in pictures
|
|
|
|
|
Now that we're in the mood..
Determine how often (x & y) == 0 for x and y both 32bit integers.
for how many pairs (x, y) where x and y are both 32bit integers, (x & y) == 0 .
|
|
|
|
|
Every single time if I set x = 0 ...
|
|
|
|
|
|
I y is chosen as x bit wise negated, it's true for all 32 bit integers.
y=¬x
¬x & x == 0
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
Right, so that's 232 pairs, do you want to use that as your answer?
|
|
|
|
|
There would be more pairs than that, but I just don't have the time to figure it out now.
You have to figure in the numbers that also have their zero bits in the same place as the first number and only the must have zeros where the original number has a one.
All I can say it's way more than 232 by some factor that I have yet to determine, but don't have the time to do so.
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
|
Every single time if I set y = 0 ...
|
|
|
|
|
That looks suspiciously like Griffs answer, and it's still just as true (and incomplete).
|
|
|
|
|
Well I'm an IT guy after all
|
|
|
|
|
That means you copy from someone else?
|
|
|
|
|
Story of a programmer
|
|
|
|
|
If the programmer and/or the pc are drunk enough everything related to work is wrong
Microsoft ... the only place where VARIANT_TRUE != true
|
|
|
|
|
Maths
---------------------------------
Obscurum per obscurius.
Ad astra per alas porci.
Quidquid latine dictum sit, altum videtur .
|
|
|
|
|
Ah Dave is starting the Great Britain versus the world on the usage of English again.
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
I thought it was "English-speaking North America versus the World"?
It is often shortened to maths or, in English-speaking North America, math.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: I thought it was "Not-Quite-English-speaking North America versus the World"?
ftfy
---------------------------------
Obscurum per obscurius.
Ad astra per alas porci.
Quidquid latine dictum sit, altum videtur .
|
|
|
|
|
|
Congratulations, you win.
|
|
|
|
|
Ok, but why? (Please )
|
|
|
|
|
Each position has 4 options 0,0 0,1 1,0 or 1,1 3 of which will give 0 and there are 32 positions.
|
|
|
|
|
Thanks, as usual, it makes sense when looked at from the right angle
|
|
|
|
|
That's hard! The number is huge, and thinking about it has lead to delirium. Please help. For example, I can see the answer for all pairs where the first of the numbers is of the form 10000000000000000000000000000000, 01000000000000000000000000000000, etc. (i.e. a single bit is flipped. - each has 1^31 paired values.) But my head swims when I try to extend this. Usually, there's some other clever way of simplifying the problem, but I sure don't see it.
Is there a simple way to think about this, or is it a lot of calculation?
|
|
|
|
|
There is a simple way of course, I wouldn't ask you guys to try 264 combinations Ok I might, but I didn't.
Here's a start: consider the 1-bit case. 3 out of 4 inputs give 0.
There are several different ways to go from there.
|
|
|
|