Bitcoin Forum

Economy => Services => Topic started by: Evil-Knievel on January 22, 2014, 09:02:53 PM



Title: This message was too old and has been purged
Post by: Evil-Knievel on January 22, 2014, 09:02:53 PM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: dirvine on January 22, 2014, 09:14:01 PM
NUM_SIZE=32

A XOR B

for n=0 to n=32; 2^n * (((A/2^n) % 2) + (B/2^n) %2) %2)

Probably easier for me though to have written a for loop.



13YSCv8SLrBw27AdyRQY8adfsGa56viQcJ


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 22, 2014, 09:16:32 PM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: dirvine on January 22, 2014, 09:26:17 PM
NUM_SIZE=32

A XOR B

for n=0 to n=32; 2^n * (((A/2^n) % 2) + (B/2^n) %2) %2)

Probably easier for me though to have written a for loop.



13YSCv8SLrBw27AdyRQY8adfsGa56viQcJ

Hey, thanks for your answer and your intrest. However a purely arithmetic solution is search. The for loop actually is more than just maths which prevents it from putting the formula into a CAS to process it any further. Also only modulus 2^32-1 is allowed ... unfortunately there is a mod 2 in your equation.

But this idea is pretty good, I hope you come up with a pure mathematical/algebraic representation soon.  :)

Yes I spotted the mod statement and also signed numbers too after posting. I will have a wee think now :-) cheers for the question it's pretty cool.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: niniyo on January 22, 2014, 09:32:27 PM
How is this?

Sum from n = 1 to 32:
  (((a mod 2^n) / 2^(n-1)) * 2^(n-1)) + (((b mod 2^n) / 2^(n-1)) * 2^(n-1))

I don't quite understand what you mean about only being able to use modulus 2^32-1?  Isn't 2^32-1 the maximum number, so anything mod that would just give the same number back?


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 22, 2014, 09:49:49 PM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: niniyo on January 22, 2014, 10:11:35 PM
OK how about this:

function mymod (value, modpow) =>
  ; returns the 32-bit result of value mod 2^modpow
  ((value * 2^(32-modpow) MOD 2^32) / 2^(32-modpow));


; note that the above is a mathematical expression, and i'm just going to use it like a macro to avoid repeating the same expression all the time

function myxor (a, b) =>
  ; return the 32-bit result of a bitwise xor b
  sum from n = 1 to 32:
    mymod(mymod(a,n) / 2^(n-1) * 2^(n-1) + mymod(a,n) / 2^(n-1) * 2^(n-1), n)

EDIT: I used the expression ((n / 2^n) * 2^n) to zero out the lowest n bits, because I'm assuming these are integer operations so a division results in the truncated integer result.  Is that suitable?


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on January 22, 2014, 10:22:21 PM
Code:
#include <iostream> 
#include <stdio.h>

using namespace std;

int main (int argc, char *argv[])
{
    unsigned long a = 0x01234567ul;
    unsigned long b = 0x87654321ul;
    unsigned long x = 0;
    unsigned long d = 1;
    unsigned long n, r;

    for (n=0; n<32; n++) {
        r = a + b;
        r *= 2147483648ul;
        r /= (2147483648ul/d);
        x += r;
        a /= 2;
        b /= 2;
        d *= 2;
    }
    printf("x=0x%08lX xor is 0x%08lX\n", x, 0x01234567ul ^ 0x87654321ul);
}


C:\Work\xor\Debug>xor
x=0x86460646 xor is 0x86460646


Don't know if this is what you are looking for but it did work.

PS:  I kind of like that snip of code...


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: niniyo on January 22, 2014, 10:26:41 PM
OP - can you clarify whether integer operations are supported?  Like, 5 / 2 = 2?  Or, since it's purely mathematical, would that be 2.5?  If so, can we use the floor() function?


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: OP_CHECKSIG on January 22, 2014, 10:27:37 PM
Here's javascript code that works...

function xor32bit(a,b){
   var sum=0;
   var x,shift;
   var s32 = Math.pow(2,32);
   var s31 = Math.pow(2,31);

   for (n=0;n<32;n++){
      shift = Math.pow(2,n);
      // move current bits to b0 and add
      x= Math.floor(a/shift)+Math.floor(b/shift);
      // move to most significant bit to clear out left bits
      x*= s31;
      // mod to keep in 32 bits range
      x=x%s32;
      // divide to put back in right it position
      x=Math.floor(x/Math.pow(2,(31-n)));
      // add to sum
      sum+=x;
   }
   return sum;
}

console.log(xor32bit(0x12345678,0).toString(16));
console.log(xor32bit(0x12345678,0xffffffff).toString(16));

Equation is sum for n 0..31 (((a/2^n+b/2^n)x2^31)mod 2^32)/2^(31-n)



Title: This message was too old and has been purged
Post by: Evil-Knievel on January 22, 2014, 10:44:00 PM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: niniyo on January 22, 2014, 10:47:35 PM
OK here is my final submission which should be purely mathematical and doesn't require rounded integer arithmetic operations.  It uses a floor() function.

Code:
; note that the following two helper functions are mathematical expressions, and i'm just going to use them like macros to avoid repeating the same expression all the time
function mymod (value, modpow) =>
  ; returns the 32-bit result of value mod 2^modpow
  ((value * 2^(32-modpow) MOD 2^32) / 2^(32-modpow));

function clearbits (value, n) =>
  ; returns the 32-bit value with the lowest n bits cleared
  floor(value / 2^n) * 2^n;

; main function for calculating the result.  returns the 32-bit result of a bitwise-xor b.
function myxor (a, b) =>
  sum from n = 1 to 32:
    ; add the value of the nth bit of the xor result
    mymod(clearbits(mymod(a,n), n-1) + clearbits(mymod(a,n), n-1), n)


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on January 22, 2014, 10:48:56 PM
Here's javascript code that works...

function xor32bit(a,b){
   var sum=0;
   var x,shift;
   var s32 = Math.pow(2,32);
   var s31 = Math.pow(2,31);

   for (n=0;n<32;n++){
      shift = Math.pow(2,n);
      // move current bits to b0 and add
      x= Math.floor(a/shift)+Math.floor(b/shift);
      // move to most significant bit to clear out left bits
      x*= s31;
      // mod to keep in 32 bits range
      x=x%s32;
      // divide to put back in right it position
      x=Math.floor(x/Math.pow(2,(31-n)));
      // add to sum
      sum+=x;
   }
   return sum;
}

console.log(xor32bit(0x12345678,0).toString(16));
console.log(xor32bit(0x12345678,0xffffffff).toString(16));

Equation is sum for n 0..31 (((a/2^n+b/2^n)x2^31)mod 2^32)/2^(31-n)


Basically what I did up above in my post but it looks like he is not looking for an algorithm...


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: OP_CHECKSIG on January 22, 2014, 11:35:35 PM
Expand the sum to long form?
Code:
x = ((((a+b)x2^31)mod 2^32)/2^(31))+((((a/2+b/2)x2^31)mod 2^32)/2^(30))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(29))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(28))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(27))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(26))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(25))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(24))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(23))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(22))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(21))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(20))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(19))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(18))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(17))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(16))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(15))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(14))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(13))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(12))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(11))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(10))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(9))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(8))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(7))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(6))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(5))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(4))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(3))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(2))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(1))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(0))


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on January 23, 2014, 12:02:29 AM
The above post is NOT correct but this one is, and it is just the unwinding of my loop in post #8 above so it is the same solution.

Code:
     x = (a/0x00000001 + b/0x00000001) * 0x80000000 / 0x80000000 + 
        (a/0x00000002 + b/0x00000002) * 0x80000000 / 0x40000000 +
        (a/0x00000004 + b/0x00000004) * 0x80000000 / 0x20000000 +
        (a/0x00000008 + b/0x00000008) * 0x80000000 / 0x10000000 +
        (a/0x00000010 + b/0x00000010) * 0x80000000 / 0x08000000 +
        (a/0x00000020 + b/0x00000020) * 0x80000000 / 0x04000000 +
        (a/0x00000040 + b/0x00000040) * 0x80000000 / 0x02000000 +
        (a/0x00000080 + b/0x00000080) * 0x80000000 / 0x01000000 +
        (a/0x00000100 + b/0x00000100) * 0x80000000 / 0x00800000 +
        (a/0x00000200 + b/0x00000200) * 0x80000000 / 0x00400000 +
        (a/0x00000400 + b/0x00000400) * 0x80000000 / 0x00200000 +
        (a/0x00000800 + b/0x00000800) * 0x80000000 / 0x00100000 +
        (a/0x00001000 + b/0x00001000) * 0x80000000 / 0x00080000 +
        (a/0x00002000 + b/0x00002000) * 0x80000000 / 0x00040000 +
        (a/0x00004000 + b/0x00004000) * 0x80000000 / 0x00020000 +
        (a/0x00008000 + b/0x00008000) * 0x80000000 / 0x00010000 +
        (a/0x00010000 + b/0x00010000) * 0x80000000 / 0x00008000 +
        (a/0x00020000 + b/0x00020000) * 0x80000000 / 0x00004000 +
        (a/0x00040000 + b/0x00040000) * 0x80000000 / 0x00002000 +
        (a/0x00080000 + b/0x00080000) * 0x80000000 / 0x00001000 +
        (a/0x00100000 + b/0x00100000) * 0x80000000 / 0x00000800 +
        (a/0x00200000 + b/0x00200000) * 0x80000000 / 0x00000400 +
        (a/0x00400000 + b/0x00400000) * 0x80000000 / 0x00000200 +
        (a/0x00800000 + b/0x00800000) * 0x80000000 / 0x00000100 +
        (a/0x01000000 + b/0x01000000) * 0x80000000 / 0x00000080 +
        (a/0x02000000 + b/0x02000000) * 0x80000000 / 0x00000040 +
        (a/0x04000000 + b/0x04000000) * 0x80000000 / 0x00000020 +
        (a/0x08000000 + b/0x08000000) * 0x80000000 / 0x00000010 +
        (a/0x10000000 + b/0x10000000) * 0x80000000 / 0x00000008 +
        (a/0x20000000 + b/0x20000000) * 0x80000000 / 0x00000004 +
        (a/0x40000000 + b/0x40000000) * 0x80000000 / 0x00000002 +
        (a/0x80000000 + b/0x80000000) * 0x80000000 / 0x00000001 ;

Tested and it works on C++.  You may need to add some masking and truncating operations in there - depending on exactly how the programming language you use works.  However, the basic idea is sound.

Did I win?


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: gogodr on January 23, 2014, 12:55:12 AM
uhm...I have a very simple solution here...

entry 1:
XOR:
f(x,y) = 0^(0^((1+x)mod(1+y)));

entry 2:
XOR:
f(x,y) = 0^(0^(x-y)); ,x>=y
f(x,y) = 0^(0^(y-x)); ,x<y


you know 0^0 == 1 , you can use that to convert logic into mathematics.
f(5,5) == 0
f(5,6) == 1
f(6,0) == 1
f(0,0) == 0

edit: I know 0^0 should be indeterminate but it is a convention.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on January 23, 2014, 01:04:38 AM
uhm...I have a very simple solution here...

entry 1:
XOR:
f(x,y) = 0^(0^((1+x)mod(1+y)));

entry 2:
XOR:
f(x,y) = 0^(0^(x-y)); ,x>=y
f(x,y) = 0^(0^(y-x)); ,x<y


you know 0^0 == 1 , you can use that to convert logic into mathematics.
f(5,5) == 0
f(5,6) == 1
f(6,0) == 1
f(0,0) == 0


He wants the bitwise XOR of the values:

XOR(5,5) = 0
XOR(5,6) = 3
XOR(6,0) = 6
XOR(0,0) = 0

So your formula does not give the correct results, however, mine does ;)


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: niniyo on January 23, 2014, 01:15:15 AM
You may need to add some masking and truncating operations in there - depending on exactly how the programming language you use works.  However, the basic idea is sound.

Did I win?

No.  The whole point was that it has to be a purely mathematical solution.  Relying on a programming language to truncate values and handle overflows is not purely mathematical.  You're supposed to think in terms of mathematical operations, not machine operations.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on January 23, 2014, 01:26:38 AM
Here I added the one allowed mod operation.  Per this explaination of what is allowed:

That means, that if you create an overflow and you temporarily use more than 32 bits, you can strip it down to 32bit my using a "mod 2^32-1" operation  ;)

The allowed mod operation is actually mod 2^32 not 2^32-1 as suggested in the OP - OP should be corrected.

This is pure integer math, not relying on the "machine" to do the truncation of the multiply.

As far as I can tell this single equation should satisfy the requirements of the puzzle.

Code:
     x = (((a/0x00000001 + b/0x00000001) * 0x80000000) % 0x100000000) / 0x80000000 + 
(((a/0x00000002 + b/0x00000002) * 0x80000000) % 0x100000000) / 0x40000000 +
(((a/0x00000004 + b/0x00000004) * 0x80000000) % 0x100000000) / 0x20000000 +
(((a/0x00000008 + b/0x00000008) * 0x80000000) % 0x100000000) / 0x10000000 +
(((a/0x00000010 + b/0x00000010) * 0x80000000) % 0x100000000) / 0x08000000 +
(((a/0x00000020 + b/0x00000020) * 0x80000000) % 0x100000000) / 0x04000000 +
(((a/0x00000040 + b/0x00000040) * 0x80000000) % 0x100000000) / 0x02000000 +
(((a/0x00000080 + b/0x00000080) * 0x80000000) % 0x100000000) / 0x01000000 +
(((a/0x00000100 + b/0x00000100) * 0x80000000) % 0x100000000) / 0x00800000 +
(((a/0x00000200 + b/0x00000200) * 0x80000000) % 0x100000000) / 0x00400000 +
(((a/0x00000400 + b/0x00000400) * 0x80000000) % 0x100000000) / 0x00200000 +
(((a/0x00000800 + b/0x00000800) * 0x80000000) % 0x100000000) / 0x00100000 +
(((a/0x00001000 + b/0x00001000) * 0x80000000) % 0x100000000) / 0x00080000 +
(((a/0x00002000 + b/0x00002000) * 0x80000000) % 0x100000000) / 0x00040000 +
(((a/0x00004000 + b/0x00004000) * 0x80000000) % 0x100000000) / 0x00020000 +
(((a/0x00008000 + b/0x00008000) * 0x80000000) % 0x100000000) / 0x00010000 +
(((a/0x00010000 + b/0x00010000) * 0x80000000) % 0x100000000) / 0x00008000 +
(((a/0x00020000 + b/0x00020000) * 0x80000000) % 0x100000000) / 0x00004000 +
(((a/0x00040000 + b/0x00040000) * 0x80000000) % 0x100000000) / 0x00002000 +
(((a/0x00080000 + b/0x00080000) * 0x80000000) % 0x100000000) / 0x00001000 +
(((a/0x00100000 + b/0x00100000) * 0x80000000) % 0x100000000) / 0x00000800 +
(((a/0x00200000 + b/0x00200000) * 0x80000000) % 0x100000000) / 0x00000400 +
(((a/0x00400000 + b/0x00400000) * 0x80000000) % 0x100000000) / 0x00000200 +
(((a/0x00800000 + b/0x00800000) * 0x80000000) % 0x100000000) / 0x00000100 +
(((a/0x01000000 + b/0x01000000) * 0x80000000) % 0x100000000) / 0x00000080 +
(((a/0x02000000 + b/0x02000000) * 0x80000000) % 0x100000000) / 0x00000040 +
(((a/0x04000000 + b/0x04000000) * 0x80000000) % 0x100000000) / 0x00000020 +
(((a/0x08000000 + b/0x08000000) * 0x80000000) % 0x100000000) / 0x00000010 +
(((a/0x10000000 + b/0x10000000) * 0x80000000) % 0x100000000) / 0x00000008 +
(((a/0x20000000 + b/0x20000000) * 0x80000000) % 0x100000000) / 0x00000004 +
(((a/0x40000000 + b/0x40000000) * 0x80000000) % 0x100000000) / 0x00000002 +
(((a/0x80000000 + b/0x80000000) * 0x80000000) % 0x100000000) / 0x00000001 ;


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: empoweoqwj on January 23, 2014, 04:07:28 AM
Surely if the solution exists, you could just google it and paste in the solution? I'm guessing it can't be done ....


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: tubbyjr on January 23, 2014, 04:07:37 AM
He basically wants to be able to put it into a calculator... Try doing 0x0001000 in a calculator and see what you get.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on January 23, 2014, 05:55:26 AM
Most good calculators will accept hex numbers exactly as shown in my post.  At any rate all the constants can be converted to decimal if needed.  The formula is correct and satisfies the rules.

Did I win?


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 23, 2014, 07:45:12 AM
This message was too old and has been purged


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 23, 2014, 07:56:47 AM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: tubbyjr on January 23, 2014, 09:29:34 AM
Most good calculators will accept hex numbers exactly as shown in my post.  At any rate all the constants can be converted to decimal if needed.  The formula is correct and satisfies the rules.

Did I win?

Touche, I believe you do win, congrats either way. I just had a quick skim and it looked more like some C++ code at first, but now I see it is indeed purely mathematical.


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 23, 2014, 10:18:32 AM
This message was too old and has been purged


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 23, 2014, 10:19:56 AM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: deepceleron on January 23, 2014, 10:55:22 AM
As far as I can tell this single equation should satisfy the requirements of the puzzle.

Code:
     x = (((a/0x00000001 + b/0x00000001) * 0x80000000) % 0x100000000) / 0x80000000 + 
(((a/0x00000002 + b/0x00000002) * 0x80000000) % 0x100000000) / 0x40000000 +
(((a/0x00000004 + b/0x00000004) * 0x80000000) % 0x100000000) / 0x20000000 +
(((a/0x00000008 + b/0x00000008) * 0x80000000) % 0x100000000) / 0x10000000 +
(((a/0x00000010 + b/0x00000010) * 0x80000000) % 0x100000000) / 0x08000000 +
(((a/0x00000020 + b/0x00000020) * 0x80000000) % 0x100000000) / 0x04000000 +
(((a/0x00000040 + b/0x00000040) * 0x80000000) % 0x100000000) / 0x02000000 +
(((a/0x00000080 + b/0x00000080) * 0x80000000) % 0x100000000) / 0x01000000 +
(((a/0x00000100 + b/0x00000100) * 0x80000000) % 0x100000000) / 0x00800000 +
(((a/0x00000200 + b/0x00000200) * 0x80000000) % 0x100000000) / 0x00400000 +
(((a/0x00000400 + b/0x00000400) * 0x80000000) % 0x100000000) / 0x00200000 +
(((a/0x00000800 + b/0x00000800) * 0x80000000) % 0x100000000) / 0x00100000 +
(((a/0x00001000 + b/0x00001000) * 0x80000000) % 0x100000000) / 0x00080000 +
(((a/0x00002000 + b/0x00002000) * 0x80000000) % 0x100000000) / 0x00040000 +
(((a/0x00004000 + b/0x00004000) * 0x80000000) % 0x100000000) / 0x00020000 +
(((a/0x00008000 + b/0x00008000) * 0x80000000) % 0x100000000) / 0x00010000 +
(((a/0x00010000 + b/0x00010000) * 0x80000000) % 0x100000000) / 0x00008000 +
(((a/0x00020000 + b/0x00020000) * 0x80000000) % 0x100000000) / 0x00004000 +
(((a/0x00040000 + b/0x00040000) * 0x80000000) % 0x100000000) / 0x00002000 +
(((a/0x00080000 + b/0x00080000) * 0x80000000) % 0x100000000) / 0x00001000 +
(((a/0x00100000 + b/0x00100000) * 0x80000000) % 0x100000000) / 0x00000800 +
(((a/0x00200000 + b/0x00200000) * 0x80000000) % 0x100000000) / 0x00000400 +
(((a/0x00400000 + b/0x00400000) * 0x80000000) % 0x100000000) / 0x00000200 +
(((a/0x00800000 + b/0x00800000) * 0x80000000) % 0x100000000) / 0x00000100 +
(((a/0x01000000 + b/0x01000000) * 0x80000000) % 0x100000000) / 0x00000080 +
(((a/0x02000000 + b/0x02000000) * 0x80000000) % 0x100000000) / 0x00000040 +
(((a/0x04000000 + b/0x04000000) * 0x80000000) % 0x100000000) / 0x00000020 +
(((a/0x08000000 + b/0x08000000) * 0x80000000) % 0x100000000) / 0x00000010 +
(((a/0x10000000 + b/0x10000000) * 0x80000000) % 0x100000000) / 0x00000008 +
(((a/0x20000000 + b/0x20000000) * 0x80000000) % 0x100000000) / 0x00000004 +
(((a/0x40000000 + b/0x40000000) * 0x80000000) % 0x100000000) / 0x00000002 +
(((a/0x80000000 + b/0x80000000) * 0x80000000) % 0x100000000) / 0x00000001 ;


I have tried to implement this in Python, and don't get a correct answer using integer or floating point math. ((EDIT: found my problem, and "int only" math works, I messed up the 231 ))
Code:
def int_xor(a, b):
        x = 0
        for n in xrange(32):  # loop values 0-31
            x += (((a / 2 ** n + b / 2 ** n) * 2 ** 31) % 2 ** 32 ) / 2 ** (31 - n)
        return x

>>> int_xor(255,0)
255L
>>> int_xor(128,256)
384L

Code:
def float_xor(a, b):
    x = 0.0
    for n in xrange(32):
        nf = float(n)
        x += (((a / 2.0 ** nf + b / 2.0 ** nf) * 2.0 ** 31.0) % 2.0 ** 32.0) / 2.0 ** (31.0 - nf)
    return x

>>> float_xor(255.0,0.0)
6622.0
>>> float_xor(128.0,256.0)
9344.0
>>>

It would seem out of the gate this still relies on or invokes int decimal truncation, for a = 3, the first op on line 2 is 3/2:
x = (((a/0x00000002 + b/0x00000002) ...


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: deepceleron on January 23, 2014, 11:22:08 AM
The first challenge in this thought exercise is how do you extract the value of a bit using only formulas, and not int or mod?

I give you two numbers, 0b0101 = 5 or 0b0111 = 7. Tell me if the 2 bit is set. Allowed operators: powers, *, /, + and -.


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 23, 2014, 11:27:24 AM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: niniyo on January 23, 2014, 12:49:48 PM
E-K can you look at my latest submission on the first page of this thread and tell me what's wrong with it?

Thanks.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on January 23, 2014, 01:21:07 PM
Yes, my solution is pure integer math - not floating point math.

The operation of "choping off everything above 32 bits" is mod 2^32 not mod 2^32-1, mod 2^32-1 makes very little sense as an operation for any purpose so perhaps you really mean that you are doing bitwise AND with 2^32-1 which is the same thing as mod 2^32?

If doing this with floating point then you need to throw away the fractional part of every divide.  

To answer the question why your python does not work you are multiplying by the wrong thing it is always 2^31 you have 2^(31-n)


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: deepceleron on January 23, 2014, 01:38:32 PM
I found the python problem. I didn't have a constant 231 in the middle, and it now seems to work when only using the integer function and of course passing integers. (stupid edits, I found my goof independently...)

I would think a mathematics computing and simulation platform would have no concept of int data types presented to the user though, you would have to call an int() function.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on January 23, 2014, 01:46:12 PM
If there is a python operator to throw away the fraction after each divide can you modify your python to apply that on the two divides in your sript so we can make sure it works?


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 23, 2014, 01:50:14 PM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: deepceleron on January 23, 2014, 01:51:49 PM
I can put the int functions in the right place for float.

I think the OP has made a non-solvable challenge. The solution of shifting left and shifting right to truncate to one bit at a time is as elegant as it is going to get.

If mod is the only function that can be used, but unlimited variables can be used, you could discover the bits with maths.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: deepceleron on January 23, 2014, 02:01:41 PM
Just a pointer ... it might be sufficient to find a representation of the AND operator ;-)

I have not yet proven it, but I think that A XOR B = A+B-2(A AND B)

For individual bits using and, multiplication, and inversion:
http://asicdigitaldesign.files.wordpress.com/2007/05/high-z_solution_02.png

(I'll keep adding)
The truth table for xor is:
ABX
000
011
101
110

Your truth table:
ABX
000+0-2(0)=0
010+1-2(1)=1
101+0-2(1)=1
111+1-2(1)=0
although if you can use a logic operation, why can't we just use the correct one?


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 23, 2014, 02:02:51 PM
This message was too old and has been purged


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 23, 2014, 02:34:16 PM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: deepceleron on January 23, 2014, 03:09:15 PM
I think I can solve this using the initial terms, but it will have to be later today.
"Allowed operators: powers, *, /, + and -. Also modulo (2^32-1) is allowed."

The mod rule is not a hindrance if we were given infinite precision, as x % 2^32 can be obtained by x *((2^32-1)/(2^32)) % (2^32-1), but I assume this would not be allowed due to some computing platforms with limited float precision (it works in python to 53 sig figs):

def mod32(r):
   r = float(r)    
   return ((r/2.0**32.0 * (2.0**32.0-1.0)) % (2.0**32.0-1.0)) * 2.0**32.0 / (2.0**32.0-1.0)

>>> print mod32(1), 1 % 0x100000000
1.0 1
>>> print mod32(0xffffffff), 0xffffffff % 0x100000000
4294967295.0 4294967295
>>> print mod32(0x100000000), 0x100000000 % 0x100000000
0.0 0



If not, it will have to be via math->logic, as in all bits are set : (x-(x%(2^32-1)))/(2^32-1)



Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on January 23, 2014, 04:29:27 PM
Why on Earth do you have a mod 2^32-1 and not mod 2^32?

The result of mod 2^32-1 (on an integer) gives you results from 0x00000000 to 0xFFFFFFFE

Seems pretty worthless.  Are you SURE that is the correct formula for the allowed mod operator?

Please double check this because your description of what the allowed mod operator does:

"chop off the bits above 32 bits"

would indicate that the allowed operator is really mod 2^32.

mod 2^32-1 does not "chop off all the bits above 32 bits".

Scaling by 2^32-1 would work (as shown above) but what a total PITA.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: OP_CHECKSIG on January 23, 2014, 04:35:34 PM
I'm with BurtW on this.  BTW.. way more than $200 worth of effort in this thread already  :o


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on January 23, 2014, 04:37:33 PM
I love puzzles and work is slow right now.  Speaking of work, got a meeting, be back later.


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 23, 2014, 07:38:09 PM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on January 23, 2014, 07:54:07 PM
Hmmm.  The method I described would require you to use the mod 2^32 thirty-two times and it does not simplify as you suggested (the mod cannot be pulled out of the formula).  It also requires you to use integer math, not floating point, or figure out a way to throw away the fractional part of all the divides.

If you add mod 2^32 and use integer math (or throw away the fractional parts of the divides) then you have a solution, otherwise no.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: deepceleron on January 24, 2014, 03:13:09 AM
Hi! Well, the 232-1 is needed for one purpose.
Let us keep it simple: In order to rorate a 8 bitfield (lets say x) once to the left, you would do the following operation: x*2 mod (28-1)

Lets quickly verify:
10010110 = 150

Bitrotation to the left:
00101101 = 45

Now doublecheck with math operator:
150*2 mod (28 -1) = 45   WORKS LIKE A CHARM!

Now what we want it is in the 32bit case the following (very simplified case):
x = x xor LEFT_ROTATE(y)

As the modulo operator is pretty costly I would want to apply it only once! Meaning ... performing all the calculations, and afterwards doing once the "mod 232-1".
This is perfectly legit, as the modulo operator is completely associative  [e.g.  (a mod n) + (b mod n) = (a+b) mod n  - as well as - (a * b) mod n = (a mod n) * (b mod n)  ] :)
Modulo is not costly. In some cases, it can be faster in CPU than instructions to store data.
XOR is bitwise arithmetic mod 2, it will take 3 mod operations per bit outside of that needed to shuffle things around. I will only adapt your silly mod to into mod 2, which I have already written.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on January 25, 2014, 05:47:34 AM
If it is not too late, I would like to offer a possible solution.

Basically, it uses the following formula to implement a single bit XOR:

xor (1 bit)=  0^(0^(a+b) + 0^(2-(a+b)))

I implement modulus using the following formula:

mod= 0^(1+(-1)^(N/(2^bit_position)))

It makes use of the fact that -1 to an even power yields 1, while -1 to an odd power yields -1... adding this output to 1, gives values of 0 and 2.  Raising 0 to either 0 or 2 yields 1 or 0, thus when n is even, the result is 0, and when n is odd, the result is 1... basically the same result as N mod 2.

This program is written in Perl and uses the int() function which is the same thing as the floor function.  It can be omitted entirely if done using integer math.  If this doesn't work for you, I might be able to code around it.  Anyway, here goes:

#!/usr/bin/perl

$buf= <STDIN>;
my ($a, $b)= split /\s/, $buf;

$result= 0**(0**(0**(1+(-1)**int($a))+0**(1+(-1)**int($b)))+0**(2-(0**(1+(-1)**int($a))+0**(1+(-1)**int($b)))))+
0**(0**(0**(1+(-1)**int($a/2))+0**(1+(-1)**int($b/2)))+0**(2-(0**(1+(-1)**int($a/2))+0**(1+(-1)**int($b/2)))))*2+
0**(0**(0**(1+(-1)**int($a/4))+0**(1+(-1)**int($b/4)))+0**(2-(0**(1+(-1)**int($a/4))+0**(1+(-1)**int($b/4)))))*4+
0**(0**(0**(1+(-1)**int($a/8))+0**(1+(-1)**int($b/8)))+0**(2-(0**(1+(-1)**int($a/8))+0**(1+(-1)**int($b/8)))))*8+
0**(0**(0**(1+(-1)**int($a/16))+0**(1+(-1)**int($b/16)))+0**(2-(0**(1+(-1)**int($a/16))+0**(1+(-1)**int($b/16)))))*16+
0**(0**(0**(1+(-1)**int($a/32))+0**(1+(-1)**int($b/32)))+0**(2-(0**(1+(-1)**int($a/32))+0**(1+(-1)**int($b/32)))))*32+
0**(0**(0**(1+(-1)**int($a/64))+0**(1+(-1)**int($b/64)))+0**(2-(0**(1+(-1)**int($a/64))+0**(1+(-1)**int($b/64)))))*64+
0**(0**(0**(1+(-1)**int($a/128))+0**(1+(-1)**int($b/128)))+0**(2-(0**(1+(-1)**int($a/128))+0**(1+(-1)**int($b/128)))))*128+
0**(0**(0**(1+(-1)**int($a/256))+0**(1+(-1)**int($b/256)))+0**(2-(0**(1+(-1)**int($a/256))+0**(1+(-1)**int($b/256)))))*256+
0**(0**(0**(1+(-1)**int($a/512))+0**(1+(-1)**int($b/512)))+0**(2-(0**(1+(-1)**int($a/512))+0**(1+(-1)**int($b/512)))))*512+
0**(0**(0**(1+(-1)**int($a/1024))+0**(1+(-1)**int($b/1024)))+0**(2-(0**(1+(-1)**int($a/1024))+0**(1+(-1)**int($b/1024)))))*1024+
0**(0**(0**(1+(-1)**int($a/2048))+0**(1+(-1)**int($b/2048)))+0**(2-(0**(1+(-1)**int($a/2048))+0**(1+(-1)**int($b/2048)))))*2048+
0**(0**(0**(1+(-1)**int($a/4096))+0**(1+(-1)**int($b/4096)))+0**(2-(0**(1+(-1)**int($a/4096))+0**(1+(-1)**int($b/4096)))))*4096+
0**(0**(0**(1+(-1)**int($a/8192))+0**(1+(-1)**int($b/8192)))+0**(2-(0**(1+(-1)**int($a/8192))+0**(1+(-1)**int($b/8192)))))*8192+
0**(0**(0**(1+(-1)**int($a/16384))+0**(1+(-1)**int($b/16384)))+0**(2-(0**(1+(-1)**int($a/16384))+0**(1+(-1)**int($b/16384)))))*16384+
0**(0**(0**(1+(-1)**int($a/32768))+0**(1+(-1)**int($b/32768)))+0**(2-(0**(1+(-1)**int($a/32768))+0**(1+(-1)**int($b/32768)))))*32768+
0**(0**(0**(1+(-1)**int($a/65536))+0**(1+(-1)**int($b/65536)))+0**(2-(0**(1+(-1)**int($a/65536))+0**(1+(-1)**int($b/65536)))))*65536+
0**(0**(0**(1+(-1)**int($a/131072))+0**(1+(-1)**int($b/131072)))+0**(2-(0**(1+(-1)**int($a/131072))+0**(1+(-1)**int($b/131072)))))*131072+
0**(0**(0**(1+(-1)**int($a/262144))+0**(1+(-1)**int($b/262144)))+0**(2-(0**(1+(-1)**int($a/262144))+0**(1+(-1)**int($b/262144)))))*262144+
0**(0**(0**(1+(-1)**int($a/524288))+0**(1+(-1)**int($b/524288)))+0**(2-(0**(1+(-1)**int($a/524288))+0**(1+(-1)**int($b/524288)))))*524288+
0**(0**(0**(1+(-1)**int($a/1048576))+0**(1+(-1)**int($b/1048576)))+0**(2-(0**(1+(-1)**int($a/1048576))+0**(1+(-1)**int($b/1048576)))))*1048576+
0**(0**(0**(1+(-1)**int($a/2097152))+0**(1+(-1)**int($b/2097152)))+0**(2-(0**(1+(-1)**int($a/2097152))+0**(1+(-1)**int($b/2097152)))))*2097152+
0**(0**(0**(1+(-1)**int($a/4194304))+0**(1+(-1)**int($b/4194304)))+0**(2-(0**(1+(-1)**int($a/4194304))+0**(1+(-1)**int($b/4194304)))))*4194304+
0**(0**(0**(1+(-1)**int($a/8388608))+0**(1+(-1)**int($b/8388608)))+0**(2-(0**(1+(-1)**int($a/8388608))+0**(1+(-1)**int($b/8388608)))))*8388608+
0**(0**(0**(1+(-1)**int($a/16777216))+0**(1+(-1)**int($b/16777216)))+0**(2-(0**(1+(-1)**int($a/16777216))+0**(1+(-1)**int($b/16777216)))))*16777216+
0**(0**(0**(1+(-1)**int($a/33554432))+0**(1+(-1)**int($b/33554432)))+0**(2-(0**(1+(-1)**int($a/33554432))+0**(1+(-1)**int($b/33554432)))))*33554432+
0**(0**(0**(1+(-1)**int($a/67108864))+0**(1+(-1)**int($b/67108864)))+0**(2-(0**(1+(-1)**int($a/67108864))+0**(1+(-1)**int($b/67108864)))))*67108864+
0**(0**(0**(1+(-1)**int($a/134217728))+0**(1+(-1)**int($b/134217728)))+0**(2-(0**(1+(-1)**int($a/134217728))+0**(1+(-1)**int($b/134217728)))))*134217728+
0**(0**(0**(1+(-1)**int($a/268435456))+0**(1+(-1)**int($b/268435456)))+0**(2-(0**(1+(-1)**int($a/268435456))+0**(1+(-1)**int($b/268435456)))))*268435456+
0**(0**(0**(1+(-1)**int($a/536870912))+0**(1+(-1)**int($b/536870912)))+0**(2-(0**(1+(-1)**int($a/536870912))+0**(1+(-1)**int($b/536870912)))))*536870912+
0**(0**(0**(1+(-1)**int($a/1073741824))+0**(1+(-1)**int($b/1073741824)))+0**(2-(0**(1+(-1)**int($a/1073741824))+0**(1+(-1)**int($b/1073741824)))))*1073741824+
0**(0**(0**(1+(-1)**int($a/2147483648))+0**(1+(-1)**int($b/2147483648)))+0**(2-(0**(1+(-1)**int($a/2147483648))+0**(1+(-1)**int($b/2147483648)))))*2147483648;

print "$result\n";



Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on January 26, 2014, 01:59:13 AM
Ok, I would like to revise my last submission then.

Realizing that your MOD 2^32-1 was essentially part of a rotate operation, it finally donned on me that my method of using the power properties of -1 would still work as a substitute modulus function which in turn would supply the bit inputs for the XOR function.  As long as I could via your rotate as described, I could set the 1's  bit, I could use even vs. odd powers of -1 as described in my previous post.

THE NEW PROGRAM:

#!/usr/bin/perl

$buf= <STDIN>;
my ($a, $b) = split /\s/, $buf;


$result= 0**(0**(0**(1+(-1)**($a*2**(32-0)%(2**32-1)))+0**(1+(-1)**($b*2**(32-0)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-0)%(2**32-1)))+0**(1+(-1)**($b*2**(32-0)%(2**32-1))))))+
0**(0**(0**(1+(-1)**($a*2**(32-1)%(2**32-1)))+0**(1+(-1)**($b*2**(32-1)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-1)%(2**32-1)))+0**(1+(-1)**($b*2**(32-1)%(2**32-1))))))*2+
0**(0**(0**(1+(-1)**($a*2**(32-2)%(2**32-1)))+0**(1+(-1)**($b*2**(32-2)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-2)%(2**32-1)))+0**(1+(-1)**($b*2**(32-2)%(2**32-1))))))*4+
0**(0**(0**(1+(-1)**($a*2**(32-3)%(2**32-1)))+0**(1+(-1)**($b*2**(32-3)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-3)%(2**32-1)))+0**(1+(-1)**($b*2**(32-3)%(2**32-1))))))*8+
0**(0**(0**(1+(-1)**($a*2**(32-4)%(2**32-1)))+0**(1+(-1)**($b*2**(32-4)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-4)%(2**32-1)))+0**(1+(-1)**($b*2**(32-4)%(2**32-1))))))*16+
0**(0**(0**(1+(-1)**($a*2**(32-5)%(2**32-1)))+0**(1+(-1)**($b*2**(32-5)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-5)%(2**32-1)))+0**(1+(-1)**($b*2**(32-5)%(2**32-1))))))*32+
0**(0**(0**(1+(-1)**($a*2**(32-6)%(2**32-1)))+0**(1+(-1)**($b*2**(32-6)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-6)%(2**32-1)))+0**(1+(-1)**($b*2**(32-6)%(2**32-1))))))*64+
0**(0**(0**(1+(-1)**($a*2**(32-7)%(2**32-1)))+0**(1+(-1)**($b*2**(32-7)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-7)%(2**32-1)))+0**(1+(-1)**($b*2**(32-7)%(2**32-1))))))*128+
0**(0**(0**(1+(-1)**($a*2**(32-8)%(2**32-1)))+0**(1+(-1)**($b*2**(32-8)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-8)%(2**32-1)))+0**(1+(-1)**($b*2**(32-8)%(2**32-1))))))*256+
0**(0**(0**(1+(-1)**($a*2**(32-9)%(2**32-1)))+0**(1+(-1)**($b*2**(32-9)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-9)%(2**32-1)))+0**(1+(-1)**($b*2**(32-9)%(2**32-1))))))*512+
0**(0**(0**(1+(-1)**($a*2**(32-10)%(2**32-1)))+0**(1+(-1)**($b*2**(32-10)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-10)%(2**32-1)))+0**(1+(-1)**($b*2**(32-10)%(2**32-1))))))*1024+
0**(0**(0**(1+(-1)**($a*2**(32-11)%(2**32-1)))+0**(1+(-1)**($b*2**(32-11)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-11)%(2**32-1)))+0**(1+(-1)**($b*2**(32-11)%(2**32-1))))))*2048+
0**(0**(0**(1+(-1)**($a*2**(32-12)%(2**32-1)))+0**(1+(-1)**($b*2**(32-12)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-12)%(2**32-1)))+0**(1+(-1)**($b*2**(32-12)%(2**32-1))))))*4096+
0**(0**(0**(1+(-1)**($a*2**(32-13)%(2**32-1)))+0**(1+(-1)**($b*2**(32-13)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-13)%(2**32-1)))+0**(1+(-1)**($b*2**(32-13)%(2**32-1))))))*8192+
0**(0**(0**(1+(-1)**($a*2**(32-14)%(2**32-1)))+0**(1+(-1)**($b*2**(32-14)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-14)%(2**32-1)))+0**(1+(-1)**($b*2**(32-14)%(2**32-1))))))*16384+
0**(0**(0**(1+(-1)**($a*2**(32-15)%(2**32-1)))+0**(1+(-1)**($b*2**(32-15)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-15)%(2**32-1)))+0**(1+(-1)**($b*2**(32-15)%(2**32-1))))))*32768+
0**(0**(0**(1+(-1)**($a*2**(32-16)%(2**32-1)))+0**(1+(-1)**($b*2**(32-16)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-16)%(2**32-1)))+0**(1+(-1)**($b*2**(32-16)%(2**32-1))))))*65536+
0**(0**(0**(1+(-1)**($a*2**(32-17)%(2**32-1)))+0**(1+(-1)**($b*2**(32-17)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-17)%(2**32-1)))+0**(1+(-1)**($b*2**(32-17)%(2**32-1))))))*131072+
0**(0**(0**(1+(-1)**($a*2**(32-18)%(2**32-1)))+0**(1+(-1)**($b*2**(32-18)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-18)%(2**32-1)))+0**(1+(-1)**($b*2**(32-18)%(2**32-1))))))*262144+
0**(0**(0**(1+(-1)**($a*2**(32-19)%(2**32-1)))+0**(1+(-1)**($b*2**(32-19)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-19)%(2**32-1)))+0**(1+(-1)**($b*2**(32-19)%(2**32-1))))))*524288+
0**(0**(0**(1+(-1)**($a*2**(32-20)%(2**32-1)))+0**(1+(-1)**($b*2**(32-20)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-20)%(2**32-1)))+0**(1+(-1)**($b*2**(32-20)%(2**32-1))))))*1048576+
0**(0**(0**(1+(-1)**($a*2**(32-21)%(2**32-1)))+0**(1+(-1)**($b*2**(32-21)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-21)%(2**32-1)))+0**(1+(-1)**($b*2**(32-21)%(2**32-1))))))*2097152+
0**(0**(0**(1+(-1)**($a*2**(32-22)%(2**32-1)))+0**(1+(-1)**($b*2**(32-22)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-22)%(2**32-1)))+0**(1+(-1)**($b*2**(32-22)%(2**32-1))))))*4194304+
0**(0**(0**(1+(-1)**($a*2**(32-23)%(2**32-1)))+0**(1+(-1)**($b*2**(32-23)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-23)%(2**32-1)))+0**(1+(-1)**($b*2**(32-23)%(2**32-1))))))*8388608+
0**(0**(0**(1+(-1)**($a*2**(32-24)%(2**32-1)))+0**(1+(-1)**($b*2**(32-24)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-24)%(2**32-1)))+0**(1+(-1)**($b*2**(32-24)%(2**32-1))))))*16777216+
0**(0**(0**(1+(-1)**($a*2**(32-25)%(2**32-1)))+0**(1+(-1)**($b*2**(32-25)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-25)%(2**32-1)))+0**(1+(-1)**($b*2**(32-25)%(2**32-1))))))*33554432+
0**(0**(0**(1+(-1)**($a*2**(32-26)%(2**32-1)))+0**(1+(-1)**($b*2**(32-26)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-26)%(2**32-1)))+0**(1+(-1)**($b*2**(32-26)%(2**32-1))))))*67108864+
0**(0**(0**(1+(-1)**($a*2**(32-27)%(2**32-1)))+0**(1+(-1)**($b*2**(32-27)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-27)%(2**32-1)))+0**(1+(-1)**($b*2**(32-27)%(2**32-1))))))*134217728+
0**(0**(0**(1+(-1)**($a*2**(32-28)%(2**32-1)))+0**(1+(-1)**($b*2**(32-28)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-28)%(2**32-1)))+0**(1+(-1)**($b*2**(32-28)%(2**32-1))))))*268435456+
0**(0**(0**(1+(-1)**($a*2**(32-29)%(2**32-1)))+0**(1+(-1)**($b*2**(32-29)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-29)%(2**32-1)))+0**(1+(-1)**($b*2**(32-29)%(2**32-1))))))*536870912+
0**(0**(0**(1+(-1)**($a*2**(32-30)%(2**32-1)))+0**(1+(-1)**($b*2**(32-30)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-30)%(2**32-1)))+0**(1+(-1)**($b*2**(32-30)%(2**32-1))))))*1073741824+
0**(0**(0**(1+(-1)**($a*2**(32-31)%(2**32-1)))+0**(1+(-1)**($b*2**(32-31)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-31)%(2**32-1)))+0**(1+(-1)**($b*2**(32-31)%(2**32-1))))))*2147483648;

print "$result\n";

Does this work for you?

MP


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: btcton on January 26, 2014, 07:27:52 AM
I'm sorry to be that guy, but what kind if calculators do you guys have? Or are you just using Python/Perl?


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: deepceleron on January 26, 2014, 08:22:03 AM
Ok, I would like to revise my last submission then.

Realizing that your MOD 2^32-1 was essentially part of a rotate operation, it finally donned on me that my method of using the power properties of -1 would still work as a substitute modulus function which in turn would supply the bit inputs for the XOR function.  As long as I could via your rotate as described, I could set the 1's  bit, I could use even vs. odd powers of -1 as described in my previous post.

THE NEW PROGRAM:
...
Does this work for you?

It works for me! In Python, pretty much as written, :

def xor(a, b):
   return 0**(0**(0**(1+(-1)**(a*2**(32-0)%(2**32-1)))+0**(1+(-1)**(b*2**(32-0)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-0)%(2**32-1)))+0**(1+(-1)**(b*2**(32-0)%(2**32-1))))))+\
0**(0**(0**(1+(-1)**(a*2**(32-1)%(2**32-1)))+0**(1+(-1)**(b*2**(32-1)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-1)%(2**32-1)))+0**(1+(-1)**(b*2**(32-1)%(2**32-1))))))*2+\
0**(0**(0**(1+(-1)**(a*2**(32-2)%(2**32-1)))+0**(1+(-1)**(b*2**(32-2)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-2)%(2**32-1)))+0**(1+(-1)**(b*2**(32-2)%(2**32-1))))))*4+\
0**(0**(0**(1+(-1)**(a*2**(32-3)%(2**32-1)))+0**(1+(-1)**(b*2**(32-3)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-3)%(2**32-1)))+0**(1+(-1)**(b*2**(32-3)%(2**32-1))))))*8+\
0**(0**(0**(1+(-1)**(a*2**(32-4)%(2**32-1)))+0**(1+(-1)**(b*2**(32-4)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-4)%(2**32-1)))+0**(1+(-1)**(b*2**(32-4)%(2**32-1))))))*16+\
0**(0**(0**(1+(-1)**(a*2**(32-5)%(2**32-1)))+0**(1+(-1)**(b*2**(32-5)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-5)%(2**32-1)))+0**(1+(-1)**(b*2**(32-5)%(2**32-1))))))*32+\
0**(0**(0**(1+(-1)**(a*2**(32-6)%(2**32-1)))+0**(1+(-1)**(b*2**(32-6)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-6)%(2**32-1)))+0**(1+(-1)**(b*2**(32-6)%(2**32-1))))))*64+\
0**(0**(0**(1+(-1)**(a*2**(32-7)%(2**32-1)))+0**(1+(-1)**(b*2**(32-7)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-7)%(2**32-1)))+0**(1+(-1)**(b*2**(32-7)%(2**32-1))))))*128+\
0**(0**(0**(1+(-1)**(a*2**(32-8)%(2**32-1)))+0**(1+(-1)**(b*2**(32-8)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-8)%(2**32-1)))+0**(1+(-1)**(b*2**(32-8)%(2**32-1))))))*256+\
0**(0**(0**(1+(-1)**(a*2**(32-9)%(2**32-1)))+0**(1+(-1)**(b*2**(32-9)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-9)%(2**32-1)))+0**(1+(-1)**(b*2**(32-9)%(2**32-1))))))*512+\
0**(0**(0**(1+(-1)**(a*2**(32-10)%(2**32-1)))+0**(1+(-1)**(b*2**(32-10)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-10)%(2**32-1)))+0**(1+(-1)**(b*2**(32-10)%(2**32-1))))))*1024+\
0**(0**(0**(1+(-1)**(a*2**(32-11)%(2**32-1)))+0**(1+(-1)**(b*2**(32-11)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-11)%(2**32-1)))+0**(1+(-1)**(b*2**(32-11)%(2**32-1))))))*2048+\
0**(0**(0**(1+(-1)**(a*2**(32-12)%(2**32-1)))+0**(1+(-1)**(b*2**(32-12)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-12)%(2**32-1)))+0**(1+(-1)**(b*2**(32-12)%(2**32-1))))))*4096+\
0**(0**(0**(1+(-1)**(a*2**(32-13)%(2**32-1)))+0**(1+(-1)**(b*2**(32-13)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-13)%(2**32-1)))+0**(1+(-1)**(b*2**(32-13)%(2**32-1))))))*8192+\
0**(0**(0**(1+(-1)**(a*2**(32-14)%(2**32-1)))+0**(1+(-1)**(b*2**(32-14)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-14)%(2**32-1)))+0**(1+(-1)**(b*2**(32-14)%(2**32-1))))))*16384+\
0**(0**(0**(1+(-1)**(a*2**(32-15)%(2**32-1)))+0**(1+(-1)**(b*2**(32-15)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-15)%(2**32-1)))+0**(1+(-1)**(b*2**(32-15)%(2**32-1))))))*32768+\
0**(0**(0**(1+(-1)**(a*2**(32-16)%(2**32-1)))+0**(1+(-1)**(b*2**(32-16)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-16)%(2**32-1)))+0**(1+(-1)**(b*2**(32-16)%(2**32-1))))))*65536+\
0**(0**(0**(1+(-1)**(a*2**(32-17)%(2**32-1)))+0**(1+(-1)**(b*2**(32-17)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-17)%(2**32-1)))+0**(1+(-1)**(b*2**(32-17)%(2**32-1))))))*131072+\
0**(0**(0**(1+(-1)**(a*2**(32-18)%(2**32-1)))+0**(1+(-1)**(b*2**(32-18)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-18)%(2**32-1)))+0**(1+(-1)**(b*2**(32-18)%(2**32-1))))))*262144+\
0**(0**(0**(1+(-1)**(a*2**(32-19)%(2**32-1)))+0**(1+(-1)**(b*2**(32-19)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-19)%(2**32-1)))+0**(1+(-1)**(b*2**(32-19)%(2**32-1))))))*524288+\
0**(0**(0**(1+(-1)**(a*2**(32-20)%(2**32-1)))+0**(1+(-1)**(b*2**(32-20)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-20)%(2**32-1)))+0**(1+(-1)**(b*2**(32-20)%(2**32-1))))))*1048576+\
0**(0**(0**(1+(-1)**(a*2**(32-21)%(2**32-1)))+0**(1+(-1)**(b*2**(32-21)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-21)%(2**32-1)))+0**(1+(-1)**(b*2**(32-21)%(2**32-1))))))*2097152+\
0**(0**(0**(1+(-1)**(a*2**(32-22)%(2**32-1)))+0**(1+(-1)**(b*2**(32-22)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-22)%(2**32-1)))+0**(1+(-1)**(b*2**(32-22)%(2**32-1))))))*4194304+\
0**(0**(0**(1+(-1)**(a*2**(32-23)%(2**32-1)))+0**(1+(-1)**(b*2**(32-23)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-23)%(2**32-1)))+0**(1+(-1)**(b*2**(32-23)%(2**32-1))))))*8388608+\
0**(0**(0**(1+(-1)**(a*2**(32-24)%(2**32-1)))+0**(1+(-1)**(b*2**(32-24)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-24)%(2**32-1)))+0**(1+(-1)**(b*2**(32-24)%(2**32-1))))))*16777216+\
0**(0**(0**(1+(-1)**(a*2**(32-25)%(2**32-1)))+0**(1+(-1)**(b*2**(32-25)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-25)%(2**32-1)))+0**(1+(-1)**(b*2**(32-25)%(2**32-1))))))*33554432+\
0**(0**(0**(1+(-1)**(a*2**(32-26)%(2**32-1)))+0**(1+(-1)**(b*2**(32-26)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-26)%(2**32-1)))+0**(1+(-1)**(b*2**(32-26)%(2**32-1))))))*67108864+\
0**(0**(0**(1+(-1)**(a*2**(32-27)%(2**32-1)))+0**(1+(-1)**(b*2**(32-27)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-27)%(2**32-1)))+0**(1+(-1)**(b*2**(32-27)%(2**32-1))))))*134217728+\
0**(0**(0**(1+(-1)**(a*2**(32-28)%(2**32-1)))+0**(1+(-1)**(b*2**(32-28)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-28)%(2**32-1)))+0**(1+(-1)**(b*2**(32-28)%(2**32-1))))))*268435456+\
0**(0**(0**(1+(-1)**(a*2**(32-29)%(2**32-1)))+0**(1+(-1)**(b*2**(32-29)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-29)%(2**32-1)))+0**(1+(-1)**(b*2**(32-29)%(2**32-1))))))*536870912+\
0**(0**(0**(1+(-1)**(a*2**(32-30)%(2**32-1)))+0**(1+(-1)**(b*2**(32-30)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-30)%(2**32-1)))+0**(1+(-1)**(b*2**(32-30)%(2**32-1))))))*1073741824+\
0**(0**(0**(1+(-1)**(a*2**(32-31)%(2**32-1)))+0**(1+(-1)**(b*2**(32-31)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-31)%(2**32-1)))+0**(1+(-1)**(b*2**(32-31)%(2**32-1))))))*2147483648

def xorf(a, b):  # floating point
   return 0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-0)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-0)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-0)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-0)%(2.0**32.0-1.0))))))+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-1)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-1)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-1)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-1)%(2.0**32.0-1.0))))))*2.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-2)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-2)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-2)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-2)%(2.0**32.0-1.0))))))*4.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-3)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-3)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-3)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-3)%(2.0**32.0-1.0))))))*8.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-4)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-4)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-4)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-4)%(2.0**32.0-1.0))))))*16.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-5)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-5)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-5)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-5)%(2.0**32.0-1.0))))))*32.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-6)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-6)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-6)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-6)%(2.0**32.0-1.0))))))*64.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-7)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-7)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-7)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-7)%(2.0**32.0-1.0))))))*128.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-8)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-8)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-8)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-8)%(2.0**32.0-1.0))))))*256.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-9)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-9)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-9)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-9)%(2.0**32.0-1.0))))))*512.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-10)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-10)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-10)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-10)%(2.0**32.0-1.0))))))*1024.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-11)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-11)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-11)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-11)%(2.0**32.0-1.0))))))*2048.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-12)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-12)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-12)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-12)%(2.0**32.0-1.0))))))*4096.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-13)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-13)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-13)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-13)%(2.0**32.0-1.0))))))*8192.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-14)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-14)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-14)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-14)%(2.0**32.0-1.0))))))*16384.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-15)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-15)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-15)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-15)%(2.0**32.0-1.0))))))*32768.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-16)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-16)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-16)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-16)%(2.0**32.0-1.0))))))*65536.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-17)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-17)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-17)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-17)%(2.0**32.0-1.0))))))*131072.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-18)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-18)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-18)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-18)%(2.0**32.0-1.0))))))*262144.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-19)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-19)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-19)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-19)%(2.0**32.0-1.0))))))*524288.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-20)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-20)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-20)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-20)%(2.0**32.0-1.0))))))*1048576.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-21)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-21)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-21)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-21)%(2.0**32.0-1.0))))))*2097152.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-22)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-22)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-22)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-22)%(2.0**32.0-1.0))))))*4194304.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-23)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-23)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-23)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-23)%(2.0**32.0-1.0))))))*8388608.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-24)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-24)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-24)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-24)%(2.0**32.0-1.0))))))*16777216.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-25)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-25)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-25)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-25)%(2.0**32.0-1.0))))))*33554432.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-26)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-26)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-26)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-26)%(2.0**32.0-1.0))))))*67108864.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-27)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-27)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-27)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-27)%(2.0**32.0-1.0))))))*134217728.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-28)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-28)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-28)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-28)%(2.0**32.0-1.0))))))*268435456.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-29)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-29)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-29)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-29)%(2.0**32.0-1.0))))))*536870912.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-30)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-30)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-30)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-30)%(2.0**32.0-1.0))))))*1073741824.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-31)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-31)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-31)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-31)%(2.0**32.0-1.0))))))*2147483648.0



>>> import random
>>> for i in xrange(20):
   a=random.randint(0,2**32-1)
   b=random.randint(0,2**32-1)
   print 'a:%8x b:%8x xor:%8x - %8x , %s' % (a, b, a^b, xor(a, b),  xor(a, b))
   print 'floating point: %12.2f' % xorf(float(a),float(b))

a:10dbc5d8 b:9c87fc6b xor:8c5c39b3 - 8c5c39b3 , 2354854323
floating point: 2354854323.00
a:7675bcc4 b:35122712 xor:43679bd6 - 43679bd6 , 1130863574
floating point: 1130863574.00
a:3fd4cd4a b:ceb8e67f xor:f16c2b35 - f16c2b35 , 4050398005
floating point: 4050398005.00
a:925bd59b b: e846797 xor:9cdfb20c - 9cdfb20c , 2631905804
floating point: 2631905804.00
a:8d2506e7 b:c78201a1 xor:4aa70746 - 4aa70746 , 1252460358
floating point: 1252460358.00
a:6953c22c b:e9a1dd67 xor:80f21f4b - 80f21f4b , 2163351371
floating point: 2163351371.00
a:197321b5 b:5eb9abd8 xor:47ca8a6d - 47ca8a6d , 1204456045
floating point: 1204456045.00
a:3ec9737a b:2997f27b xor:175e8101 - 175e8101 , 392069377
floating point: 392069377.00
a:822d1508 b:a80b10da xor:2a2605d2 - 2a2605d2 , 707134930
floating point: 707134930.00
a:faf8ac11 b:69369fba xor:93ce33ab - 93ce33ab , 2479764395
floating point: 2479764395.00
a:8db3d46b b:971874c7 xor:1aaba0ac - 1aaba0ac , 447455404
floating point: 447455404.00
a:4b559b49 b: 800f850 xor:43556319 - 43556319 , 1129669401
floating point: 1129669401.00




I'm sorry to be that guy, but what kind if calculators do you guys have? Or are you just using Python/Perl?

I think a better question is what kind of calculator do you have that can store a formula or code, but doesn't already have XOR? This does:
http://h20331.www2.hp.com/Hpsub/downloads/35_23_Base_Logic_functions.pdf

If it doesn't, but is programmable, you would have a better list of operators you can employ to do the logic functions anyway:
http://www.hpmuseum.org/software/32sbits.htm


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 26, 2014, 09:16:18 AM
This message was too old and has been purged


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 26, 2014, 01:57:01 PM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on January 26, 2014, 03:30:28 PM
I just did a few checks, however I am not sure that this operation is really a % 2^32-1 operation.
Shouldn't the modulus operator be linear? When I take it completely out, the function gives back constantly zero. I have not yet taking a deep enough look, but is this behaviour explainable?

Interestingly enough, I was just about to comment on the 2^32-1 operation when the system advised me that you had posted this response.  I'll break down the key elements of the program in steps...

It turned out that using a % 2^32-1 was ESSENTIAL to getting around the road block introduced by trying to implement right shifts as divisions by powers of 2.  The reason for this is because of the importance of getting access to the 1s bit which enables us to mask the input number (N).  Shifting right or rotating (left or right) makes it possible to step through each bit of (N) so that we can then do bitwise operations using inputs A and B.  How? Because any number N mod 2^32-1 is essentially

while (N>2^32-1)
  N=(N >> 32) + (N & 2^32-1)

This algorithm above can be derived using the fact that 2^32= 1 mod 2^32-1. So for any multiple of 2^32, that multiple mod 2^32-1 will be the multiple * 1 (mod 2^32-1). (N & 2^32-1) is the remainder < 2^32-1.  Thus iterating through this loop will eventually lead to N mod 2^32-1.  Fortunately for this challenge, we only go through the loop once to get access to any bit within the input arguments A, B.

As you described in your earlier example (with 8 bits), multiplying by powers of 2 coupled with mod 2^32-1 therefore accomplishes a rotate across 32 bits (mod 2^8-1 would be a rotate across 8 bits).   This is the method we use to set the ones bit to be the bit position within A or B that we are interested in applying the bitwise XOR function to.  The ROTATE works because we start by shifting our number N (A or B) LEFT a given number of bits.  This MAKES SPACE at the right of the number so that all bits LEFT of 2^32 will fit on the right of the number when we add (N >> 32) back on the right side (rotated).

Why is this all important and why do you get zero when you take it out?

You get zero because of the way I implemented the substitute modulus function to access the bits for the bitwise XOR:

THE KEY to understanding the alternate modulo 2 function that 0^0 is THE ONLY combination that yields 1 as an answer, ALL OTHER (positive) exponents of 0 yield 0!

Without access to INTEGER math, and armed only with the tools you gave me, I needed a way to discriminate n%2=0 from n%2=1.  Recognizing that all numbers such that N%2=1 are ODD, and all numbers such that N%2=0 are EVEN, I turned to (-1) for help.  (-1) is one of those unique numbers/bases that is binary sensitive.  Namely, that (-1)^N, no matter what the value of N yields only 2 values depending upon whether N is even or odd.  If N is even then (-1)^N equals 1, if N is odd, then (-1)^N equals -1.

Now to answer where the 0 cames from:

By adding 1 to (-1)^N, we change the range of expected values from -1, 1 to 0 (-1+1), 2 (1+1).

We now plug this into what we know about powers of 0 and get:

0^(1+(-1)^N) = N%2

if N is even, this evaluates to 0^(1+1)= 0^2= 0.  
If N is odd, this evaluates to 0^(1+(-1))= 0^0= 1.

Now we have a way to get the bit from the least most significant bit (the 1s bit) of each operand.  Originally, I like everyone else was right shifting the bits of each operand using division by powers of 2 to the ones bit position leaving the bits that I was no longer interested in to "drop off" the right side using INTEGER math.  However I couldn't use integer math, so without it, I couldn't get the discarded bits to "drop".  Instead they became decimal places to hinder my further calculations.

The sneaky part was getting the bits of interest into the ones position by ROTATING them in from the LEFT using the mod 2^32-1 operation.  In order for my alternate modulo 2 operation to work, I only care about the last bit because the last bit of N determines whether N is even or odd.  Instead of being "dropped" by a shift right operation, "discarded" bits are shifted left of the ones bit where for our purposes, THEY DON'T MATTER.  This is the essential difference between the first iteration of the program and the second iteration.  The first program discards unwanted bits by dropping them off the right using an integer function.  The second program rotates unwanted bits to the left of the ones position.

Again, the ones position is all important because it enables us a way to step through each bit of each operand (A, B), giving us a single bit to plug into our mathematically expressed XOR operation.

Concerning the XOR operation:

This too makes use of the fact that 0^0 is the only combination that yields 1, all other positive exponents yield 0.

So given bit A and bit B, a single bit XOR operation can be described as:

XOR= 0^(0^(a+b)+0^(2-(a+b)))

The truth table for a+b vs 2-(a+b) is:

a  b  a+b  2-(a+b)    0^(a+b)   0^(2-(a+b))  sum(0^(a+b)+0^(2-(a+b)))
0  0      0           2              1                  0                                       1
1  0      1           1              0                  0                                       0
0  1      1           1              0                  0                                       0
1  1      2           0              0                  1                                       1

So according to this table, the sum yields the exact opposite of what we need for XOR.
However 0^N is essentially a NOT function, so by using the sum as an exponent to 0, we
get  exactly what we are looking for:

0^1= 0
0^0= 1
0^0= 1
0^1= 0

So combining this bitwise XOR operation with the alternate modulo 2 implementation and making use of the rotate over 32 bits, we then multiply each bitwise output of the XOR function by a power of 2 representing each bit position of the result.  Lastly we sum these multiplications to build the complete bitwise XORed final output.

Thanks for the brain teaser.  This algorithm was very tricky.  When entering in as a formula, you have to be meticulous because any incorrect value introduced into the wrong exponent will yield 0 due to the fact that 0^0 is the ONLY combination that yields a non-zero value.  Once you start introducing zeros to the build multiplications, you get zeros because zero times anything is zero.

Hopefully you can now see that by removing the mod 2^32-1, you've broken the ROTATE which means that you are still left shifting the number (making space/filling the right most bit with zero) but not adding back the bits from the leftmost side of N.  This is probably evaluating all inputs to the XOR as 0, which would return 0 at every bit position, which would build an output number of 0.

Anyway, I apologize for the length of this message but I hope it explains what you are seeing and is at least a little interesting to others who may have attempted the challenge.

MP




Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on January 26, 2014, 06:13:45 PM
Surely if the solution exists, you could just google it and paste in the solution? I'm guessing it can't be done ....

It can be done :-)  The TRAP is that without access to integer math, you cannot use division to step through the bits of each operand.  As programmers, we were all stuck on the idea of using division to shift right.  This was natural because we are all used to testing the 1s bit.  The problem is that without integer math, it was proving difficult to discard unwanted bits off the end of an operand because in floating point math, the bits don't go away, they just become decimal places.

Programmers are creatures of habit just like everyone else.  From the beginning it was far more likely that we would try to shift our way through the operands vs rotate our way through them although in retrospect, rotating might have been more flexible though definitely more obscure.

Rotate operations are just as easy to program, it's just that your bits of interest have to be rotated to the ones position from the left vs shifted (or rotated) from the right (which is probably the way 99.9 out of 100 programmers would do it.)

If you think about a rotate across a 4 bit word, take the number 5: 0101 in binary. To rotate across a 4 bit word you have to use 2^4-1, 15.

Most programmers seeking to test the second bit (2^1) would prefer to shift right 1 bit by doing an integer divide by 2, yielding 5/2 or 2: 0010.   This moves the 2nd bit to the 2^0 position where it could be tested.

The tricky part is that we can also get the second bit into the last position using a left rotate.  To accomplish this, we first multiply by 2^3 (8), to shift everything 3 bits to the left:

5*8= 0101 << 3 = 0101000 (40)

Now recognize that for a 4 bit word 2^4= 1 (mod 2^4-1) which means that for every multiple of 2^4 we encounter, we are adding 1 (mod 2^4-1) or that multiple multiplied by 1 (mod 2^4-1).  That accounts for the value of the bits left of 2^4, meanwhile all the bits right of 2^4 are either less than 2^4-1 OR 2^4-1 itself.  If all the bits right of 2^4 are 1, you can think of that as the same as 0 (mod 2^4-1).

To get the modulus then we add the multiple of 2^4 to the left of 2^4 to everything right of 2^4.  In other words (40 >> 4) + (40 & 15) = 2+8 = 10 = 1010.  If we check that against the actual 40%(2^4-1) or 40%15 we also get 10.  We have rotated the bit we were interested in to the 2^0 position from the left just as we would have preferred to right shift our way there.  The difference is that opposed to our disposable bit being eaten by integer division, it has appeared at the left of our 4 bit word.

Although the value of the word has changed, it doesn't matter from the standpoint of evaluating the least most significant bit as being even (0) or odd (1). Which for this challenge means that we can step through each bit of both operands to evaluate the xor function.

In my opinion, this was the biggest stumbling block because it required us as programmers to come at it from an unfamiliar angle (left rotates) vs. the approach that we are most acquainted with (right shifts).  Shift left (<< | *2) and shift right (>> | /2) two of the most commonly used tools in the programmer tool shed.  Whether he knew it or not, the OP gave us the actual tool that we needed; force of habit was probably the reason that many of us (myself included) didn't recognize it as such at first.

MP


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: nickjer on January 27, 2014, 02:32:56 AM
I am in no way saying the last poster's solution is incorrect, but I do want to say you need to be careful with 0^0. Depending on your software choice (since OP has the strangest of conditions) 0^0 is undefined, much like 0/0 is undefined. True, most programming languages will treat 0^0 = 1, but OP may need to double check this with whatever he is using to compute the XOR function. Can check with https://www.wolframalpha.com that 0^0 is undefined.

But I am sure that won't be a problem, unless OP has extremely picky software.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on January 27, 2014, 04:43:19 AM
I am in no way saying the last poster's solution is incorrect, but I do want to say you need to be careful with 0^0. Depending on your software choice (since OP has the strangest of conditions) 0^0 is undefined, much like 0/0 is undefined. True, most programming languages will treat 0^0 = 1, but OP may need to double check this with whatever he is using to compute the XOR function. Can check with https://www.wolframalpha.com that 0^0 is undefined.

But I am sure that won't be a problem, unless OP has extremely picky software.

LORD, this is a tough room! lol.

MP


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on January 27, 2014, 05:53:01 AM
Ok, to deal with the last concern about 0^0 being undefined in some implementations, this program uses the same principles but uses a mapping of {-1,1} in place of {0, 1}.  Basically, everything else applies only to go from the former to the latter you must add 1 (+1) then divide by 2.  This works because (-1+1)/2 = 0, and (1+1)/2 = 1.

Using this we must remap our xor and alternate modulus functions such that:

xor($a,$b)= ((1+((-1)**($a+$b)+(-1)**(2-($a+$b)))/(-2))/2)

and our alternate modulo 2 function looks like:

((1-(-1)**$n)/2) = $n % 2

why?

because when $n is odd we get (1-(-1))=2/2= 1,
      and when $n is even we get (1-1)=0/2= 0.

Literally everything else (including the rotations to rotate the bits of interest to the 1s digit) is the same.

THE LASTEST (and hopefully last) PROGRAM:
#!/usr/bin/perl

my $buf=<STDIN>;
my ($a, $b)= split /\s/, $buf;

my $result=
((1+((-1)**(((1-(-1)**($a*2**(32-0)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-0)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-0)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-0)%(2**32-1)))/2))))/(-2))/2)*2**0+
((1+((-1)**(((1-(-1)**($a*2**(32-1)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-1)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-1)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-1)%(2**32-1)))/2))))/(-2))/2)*2**1+
((1+((-1)**(((1-(-1)**($a*2**(32-2)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-2)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-2)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-2)%(2**32-1)))/2))))/(-2))/2)*2**2+
((1+((-1)**(((1-(-1)**($a*2**(32-3)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-3)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-3)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-3)%(2**32-1)))/2))))/(-2))/2)*2**3+
((1+((-1)**(((1-(-1)**($a*2**(32-4)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-4)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-4)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-4)%(2**32-1)))/2))))/(-2))/2)*2**4+
((1+((-1)**(((1-(-1)**($a*2**(32-5)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-5)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-5)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-5)%(2**32-1)))/2))))/(-2))/2)*2**5+
((1+((-1)**(((1-(-1)**($a*2**(32-6)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-6)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-6)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-6)%(2**32-1)))/2))))/(-2))/2)*2**6+
((1+((-1)**(((1-(-1)**($a*2**(32-7)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-7)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-7)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-7)%(2**32-1)))/2))))/(-2))/2)*2**7+
((1+((-1)**(((1-(-1)**($a*2**(32-8)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-8)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-8)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-8)%(2**32-1)))/2))))/(-2))/2)*2**8+
((1+((-1)**(((1-(-1)**($a*2**(32-9)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-9)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-9)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-9)%(2**32-1)))/2))))/(-2))/2)*2**9+
((1+((-1)**(((1-(-1)**($a*2**(32-10)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-10)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-10)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-10)%(2**32-1)))/2))))/(-2))/2)*2**10+
((1+((-1)**(((1-(-1)**($a*2**(32-11)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-11)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-11)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-11)%(2**32-1)))/2))))/(-2))/2)*2**11+
((1+((-1)**(((1-(-1)**($a*2**(32-12)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-12)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-12)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-12)%(2**32-1)))/2))))/(-2))/2)*2**12+
((1+((-1)**(((1-(-1)**($a*2**(32-13)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-13)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-13)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-13)%(2**32-1)))/2))))/(-2))/2)*2**13+
((1+((-1)**(((1-(-1)**($a*2**(32-14)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-14)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-14)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-14)%(2**32-1)))/2))))/(-2))/2)*2**14+
((1+((-1)**(((1-(-1)**($a*2**(32-15)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-15)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-15)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-15)%(2**32-1)))/2))))/(-2))/2)*2**15+
((1+((-1)**(((1-(-1)**($a*2**(32-16)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-16)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-16)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-16)%(2**32-1)))/2))))/(-2))/2)*2**16+
((1+((-1)**(((1-(-1)**($a*2**(32-17)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-17)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-17)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-17)%(2**32-1)))/2))))/(-2))/2)*2**17+
((1+((-1)**(((1-(-1)**($a*2**(32-18)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-18)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-18)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-18)%(2**32-1)))/2))))/(-2))/2)*2**18+
((1+((-1)**(((1-(-1)**($a*2**(32-19)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-19)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-19)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-19)%(2**32-1)))/2))))/(-2))/2)*2**19+
((1+((-1)**(((1-(-1)**($a*2**(32-20)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-20)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-20)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-20)%(2**32-1)))/2))))/(-2))/2)*2**20+
((1+((-1)**(((1-(-1)**($a*2**(32-21)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-21)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-21)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-21)%(2**32-1)))/2))))/(-2))/2)*2**21+
((1+((-1)**(((1-(-1)**($a*2**(32-22)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-22)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-22)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-22)%(2**32-1)))/2))))/(-2))/2)*2**22+
((1+((-1)**(((1-(-1)**($a*2**(32-23)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-23)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-23)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-23)%(2**32-1)))/2))))/(-2))/2)*2**23+
((1+((-1)**(((1-(-1)**($a*2**(32-24)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-24)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-24)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-24)%(2**32-1)))/2))))/(-2))/2)*2**24+
((1+((-1)**(((1-(-1)**($a*2**(32-25)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-25)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-25)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-25)%(2**32-1)))/2))))/(-2))/2)*2**25+
((1+((-1)**(((1-(-1)**($a*2**(32-26)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-26)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-26)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-26)%(2**32-1)))/2))))/(-2))/2)*2**26+
((1+((-1)**(((1-(-1)**($a*2**(32-27)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-27)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-27)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-27)%(2**32-1)))/2))))/(-2))/2)*2**27+
((1+((-1)**(((1-(-1)**($a*2**(32-28)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-28)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-28)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-28)%(2**32-1)))/2))))/(-2))/2)*2**28+
((1+((-1)**(((1-(-1)**($a*2**(32-29)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-29)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-29)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-29)%(2**32-1)))/2))))/(-2))/2)*2**29+
((1+((-1)**(((1-(-1)**($a*2**(32-30)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-30)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-30)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-30)%(2**32-1)))/2))))/(-2))/2)*2**30+
((1+((-1)**(((1-(-1)**($a*2**(32-31)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-31)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-31)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-31)%(2**32-1)))/2))))/(-2))/2)*2**31;

print "$result\n";

At this point, the bottom line is that BOTH the last 2 programs should satisfy the requirements and work.  This program avoids the 0^0 convention by substituting -1 for 0 and adjusting our alternate modulo 2 and xor functions accordingly.

(Thanks nickjer)

MP



Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on January 29, 2014, 09:17:29 AM
Very clever.  EK - did you pay up?


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on January 29, 2014, 06:41:27 PM
Very clever.  EK - did you pay up?

Nope, at least not yet-- But I would like to mention that I *do* accept bitcoin :-)

I think we can all agree that it was an interesting challenge, so much so that even in spite of the novel I've written here, I'm writing a blog entry about the problem and its solution.

MP


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 30, 2014, 08:55:10 AM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on January 30, 2014, 01:13:18 PM
Sorry guys, I had a lot of hassle due to my paper deadline and some other ongoing projects.
I have just tried to eval the formula in Mathematica 9.1, however it does not yield to a valid result?
Any Ideas what might be wrong?

A huge problem are the "Null" exponents abviously.
Something somehow cannot be evaluated analytically.

http://imagize[Suspicious link removed]ageshack.us/v2/1280x1024q90/545/5f8u.png

http://imagize[Suspicious link removed]ageshack.us/v2/1280x1024q90/833/81py.png

Did you try the latest version of the program that uses -1 as a base instead of 0?  Also, I have access to Mathematica, so perhaps I can see what you are up against...

MP


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on January 30, 2014, 01:40:14 PM
Yes, I think he may need to try the new version here:

https://bitcointalk.org/index.php?topic=427712.msg4769094#msg4769094

Not any previous version.


Title: This message was too old and has been purged
Post by: Evil-Knievel on January 30, 2014, 03:57:21 PM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on January 30, 2014, 08:31:17 PM
Sorry guys, I had a lot of hassle due to my paper deadline and some other ongoing projects.
I have just tried to eval the formula in Mathematica 9.1, however it does not yield to a valid result?
Any Ideas what might be wrong?

A huge problem are the "Null" exponents abviously.
Something somehow cannot be evaluated analytically.


[ This is the Mathematica compatible version that I sent to EK via PM]

I have figured out what you were doing wrong.  Since you are using Mathematica, the modulus (mod) operator is not '%' as it is in Perl and in Python.  I have since rewritten the formula to be Mathematica compatible.  The following version was tested to run under Mathematica 7:

((1+((-1)^(((1-(-1)^(Mod[a*2^(32-0),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-0),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-0),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-0),(2^32-1)]))/2))))/(-2))/2)*2^0+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-1),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-1),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-1),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-1),(2^32-1)]))/2))))/(-2))/2)*2^1+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-2),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-2),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-2),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-2),(2^32-1)]))/2))))/(-2))/2)*2^2+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-3),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-3),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-3),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-3),(2^32-1)]))/2))))/(-2))/2)*2^3+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-4),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-4),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-4),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-4),(2^32-1)]))/2))))/(-2))/2)*2^4+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-5),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-5),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-5),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-5),(2^32-1)]))/2))))/(-2))/2)*2^5+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-6),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-6),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-6),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-6),(2^32-1)]))/2))))/(-2))/2)*2^6+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-7),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-7),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-7),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-7),(2^32-1)]))/2))))/(-2))/2)*2^7+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-8),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-8),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-8),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-8),(2^32-1)]))/2))))/(-2))/2)*2^8+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-9),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-9),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-9),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-9),(2^32-1)]))/2))))/(-2))/2)*2^9+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-10),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-10),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-10),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-10),(2^32-1)]))/2))))/(-2))/2)*2^10+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-11),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-11),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-11),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-11),(2^32-1)]))/2))))/(-2))/2)*2^11+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-12),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-12),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-12),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-12),(2^32-1)]))/2))))/(-2))/2)*2^12+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-13),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-13),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-13),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-13),(2^32-1)]))/2))))/(-2))/2)*2^13+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-14),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-14),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-14),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-14),(2^32-1)]))/2))))/(-2))/2)*2^14+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-15),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-15),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-15),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-15),(2^32-1)]))/2))))/(-2))/2)*2^15+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-16),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-16),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-16),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-16),(2^32-1)]))/2))))/(-2))/2)*2^16+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-17),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-17),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-17),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-17),(2^32-1)]))/2))))/(-2))/2)*2^17+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-18),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-18),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-18),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-18),(2^32-1)]))/2))))/(-2))/2)*2^18+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-19),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-19),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-19),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-19),(2^32-1)]))/2))))/(-2))/2)*2^19+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-20),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-20),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-20),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-20),(2^32-1)]))/2))))/(-2))/2)*2^20+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-21),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-21),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-21),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-21),(2^32-1)]))/2))))/(-2))/2)*2^21+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-22),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-22),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-22),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-22),(2^32-1)]))/2))))/(-2))/2)*2^22+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-23),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-23),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-23),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-23),(2^32-1)]))/2))))/(-2))/2)*2^23+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-24),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-24),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-24),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-24),(2^32-1)]))/2))))/(-2))/2)*2^24+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-25),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-25),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-25),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-25),(2^32-1)]))/2))))/(-2))/2)*2^25+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-26),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-26),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-26),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-26),(2^32-1)]))/2))))/(-2))/2)*2^26+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-27),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-27),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-27),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-27),(2^32-1)]))/2))))/(-2))/2)*2^27+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-28),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-28),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-28),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-28),(2^32-1)]))/2))))/(-2))/2)*2^28+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-29),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-29),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-29),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-29),(2^32-1)]))/2))))/(-2))/2)*2^29+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-30),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-30),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-30),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-30),(2^32-1)]))/2))))/(-2))/2)*2^30+
((1+((-1)^(((1-(-1)^(Mod[a*2^(32-31),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-31),(2^32-1)]))/2))+(-1)^(2-(((1-(-1)^(Mod[a*2^(32-31),(2^32-1)]))/2)+((1-(-1)^(Mod[b*2^(32-31),(2^32-1)]))/2))))/(-2))/2)*2^31

MP



Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: Mitchell on January 30, 2014, 10:45:19 PM
My brain hurts after reading this topic.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: abacus on January 31, 2014, 03:34:32 AM
My brain hurts after reading this topic.

Mine too.
And I have to admit I also skipped the 3rd page to jump directly to the end... :D


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on January 31, 2014, 11:57:49 AM
Sorry guys. 

Many years after writing my first computer program in BASIC, I still enjoy programming.  In RL, my programming is more mundane... stuff like managing email aliases, creating accounts, monitoring log files, etc.  This was the most interesting challenge I've considered in a little while, and really the only one where the "how it was done" was more interesting than the "what was done."

The OP, kinda presented the challenge like he might have some interest in how it was done.  Others answered the call, no one seemed to have the answer.  I thought it might be interesting to share the answer and how I came up with it because the principles involved actually have value for bitcoin/altcoin mining... Why? Because if you can describe logical operations mathematically, you can investigate SHA256 and sCrypt mathematically.  Who knows where that leads?  If you could simplify the mathematical expression of sCrypt for instance (and look at it), you might be able to derive an algorithm that can hash sCrypt hashes even faster by saving your compute platform redundant/superfluous processing cycles. You never know.

I didn't mean to bore anyone; my intentions were good... and then of course, there was the $200 :-)

The ironic thing? I got into computers because I wasn't particularly good at math...

MP

PS.: I'll be putting my ASIC Erupter Blade V2 configuration/monitoring tools out in source code form and GPL'd for FREE soon. I have a few mining boards, like them a lot, but realized that I would like them more if I could apportion/manage/restart/reconfigure them automatically under program control. When ready (probably I'll start with a 0.5 release), look on the forums for where to get them if you have and like the Erupter Blade hardware....


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on February 02, 2014, 05:51:35 AM
Evil-Knievel:

Could we get an update?

MP


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on February 02, 2014, 11:01:47 PM
We are all very interested to learn your intentions regarding the promised bounty.  As one who attempted to solve the problem and claim the bounty I submit to you that minerpeabody's solution does in fact work and does satisfy the criteria set forth in your original post and subsequent clarifications.

1) Did he solve it?  If not then what specifically is lacking?
2) If solved then when can he expect payment?


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: FiatKiller on February 04, 2014, 01:04:00 AM
The answer reminds me of why I made a parentheses counting tool to make sure longa$$ stuff like this has an even number of open and closed parentheses without going blind.  lol   I only have to check stuff if it says it's NG and it tells me whether it's a left or right parenthesis missing...


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: deepceleron on February 04, 2014, 02:31:33 PM
This stuff reminds me why I don't do any design work or enter any "contests" here unless the prize or bounty is held in escrow.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: abacus on February 04, 2014, 03:10:29 PM
This stuff reminds me why I don't do any design work or enter any "contests" here unless the prize or bounty is held in escrow.

Yeah, good to know...


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on February 05, 2014, 01:48:59 PM
This stuff reminds me why I don't do any design work or enter any "contests" here unless the prize or bounty is held in escrow.

Hi,

I'm obviously new here.  While I know what escrow is, how does escrow work here?  How do you identify services that you can trust?  Is there a thread that covers this?

MP
(still unpaid)


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: BurtW on February 05, 2014, 02:14:36 PM
I have tried to get him to come here and comment.  He has not.  It appears he is too busy to care about his reputation.

Any person trusted by both parties can be an escrow agent in situations like this.


Title: This message was too old and has been purged
Post by: Evil-Knievel on February 05, 2014, 06:20:22 PM
This message was too old and has been purged


Title: This message was too old and has been purged
Post by: Evil-Knievel on February 05, 2014, 07:21:10 PM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on February 05, 2014, 11:38:45 PM
The Bounty:

minerpeabody, I have just checked your solution and it indeed meets all requirements in the original posting.
So it looks like you have perfectly succeeded the task and thus qualified to claim the bounty.

Current Mt.Gox BTC Price: 1 BTC = 915 US$
If I calculate correctly, 200 US$ = (200/915)*1BTC = 0.2185... BTC - I will round it up to 0.22.

All you have to do, is provide me your BTC address.

Further, although you have perfectly completed this task I would like to dig into it a bit deeper. As most modular operations are in the exponent now, they cannot be pulled out of the equation that easily. So I hope we can brainstorm a bit more and think about how we could get rid of the nested exponents or at least of the modulus in those. This way Mathematica cannot reduce/simplify equations - that consist of many XOR terms - at all.

I hope you guys still have fun thinking about this and maybe we can work towards a pure mathematical representation of SHA256 (even if it is just for a round reduced one - e.g. the first 4 or 8 rounds).  :)

I will post my thoughts (and Mathematica worksheets) here soon.

Thank you Evil-Knievel,

You can pay me at this bitcoin address:

1KUhB2S8Xwp2eE3Tsn9NRtd9HWNxvp3Dx2

As I contemplate your response, I think that you might be able to get somewhere using fuzzy logic.  If one substitute (-1) for (0), ie: {-1, 1} as opposed to {0, 1}, a single XOR can be expressed as:

(-1)^((a+b)^2/4)

It is difficult to escape the modulo math because without it, it's difficult to isolate individual bits. Using negative vs positive numbers (as opposed to individual numbers) might work, but that is just the first thought off the top of my head.

MP


Title: This message was too old and has been purged
Post by: Evil-Knievel on February 06, 2014, 05:09:31 PM
This message was too old and has been purged


Title: This message was too old and has been purged
Post by: Evil-Knievel on February 06, 2014, 06:44:28 PM
This message was too old and has been purged


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: abacus on February 06, 2014, 06:50:53 PM
I still have to well understand how Trust rating works, but if I click on your trust link, I can't see any negative feedback for you.
Maybe the user deleted it, I don't know.

PS: I am using the default trust list.


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: serje on February 06, 2014, 07:03:15 PM
I've read all the pages and only understood half of them!

I don't know why that guy gave you negative rating as you paid people before who were using your python script.
Please take this into consideration : next time when you make a contest write that you will pay in maximum 2 days after the solution has been given!
Hopefully this way you can avoid negative ratings from people you don't know you and who are 24/7 on the forum

Also you are always a little slow with payments but always you round it up :) so in my opinion is worth the wait!


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: minerpeabody on February 06, 2014, 10:45:06 PM
SOLVED!!!!! The Bounty has been Paid!!!

Winner: MINERPEABODY
Amount: 0.22 BTC
Destination Address: 1KUhB2S8Xwp2eE3Tsn9NRtd9HWNxvp3Dx2
Tx-Hash: 97a759b16dc116ad5e72a3c9f4c251cf7b1b73ebbb51016b622cf3e6925fb970



Hello Guys,

What you get:
Bounty of 200$ (either in BTC or wire transfer)

What you need to solve:
Simple (or less simple) algrebraic-only expression of the bitwise XOR operator. Allowed operators: powers, *, /, + and -. Also modulo (2^32-1) is allowed.
During calculation, the numerical limits of 32bit may be exceeded.
Your formula should be applicable to two unsigned integers of 32 bits.

Let the game begin  ;D

Payment has been received and I have left you positive feedback. Thanks.

MP


Title: Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR
Post by: deepceleron on February 07, 2014, 02:47:16 AM
Aaaah Great, I just received a negative rating from a user called "deepceleron" on this.

I am really disappointed! Not only do I try to make interesting challenges here which I finance with my personal money, but I put a lot of effort in the science behind the bitcoin protocol and the cryptography behind it. I mean I love this work, and I really enjoy contributing to the community - what a bit upsets me is what I get back. A kick in the butt, and a negative rating! Great ;) This way science makes fun ... NOT!

Has it finally been paid BECAUSE of the feedback, though? Apparently several posts in other threads you were continuously monitoring and posting in didn't get your attention enough to come back here and even give a status update. I am an interested party because it as easily could have been me that spent several hours on a solution. I will delete the negative trust since it has been paid, not because you left extortion negative feedback (with lies - I have never contacted you and you will see the posts in this thread are constructive) and PM'd me, which will be left here forever:

Quote from: Evil-Knievel about deepceleron
Attention! Person is not trustworthy! I have made an arrangement with another guy who solved a math equation for me! I paid him for his work (see reference thread). This user was trying to insult disturb my threads from the beginning. After I told him that it is not his business at all, he started giving me negative feedback. This user cannot be trusted anymore as his feedback is not reflecting reality, but his personal attitude against other people. BEWARE!