This is a fairly simple concept, yet surprisingly difficult [for me] to state simply.
Given a multiset of integers, $M$, of finite (but arbitrary) cardinality.
And, $S_m$ is the sum over the elements of $M$, $S_m=\Sigma M$
And, $O_m$ is a submultiset of $M$ containing only the elements of $M$ that are odd.
Is there a formal proof that shows that $parity(S_m) = parity(|O_m|)$ ?
A few years ago I mentioned to a colleague that if all he wanted to do was compute the parity of the sum of (large integer) values in a distributed data source then it would not be necessary to first collect all the values, one could just sum the sums. It then struck me that even this was not necessary as the parity of the sum would be even if the collected multiset had an even number of odd numbers, and odd otherwise.
This might not sound like much of a win, but it has a few advantages:
- You only need to check, and keep track of, the parity of a list by flipping a bit if a new number is odd.
- Due to the self-similar nature each distributed system needs only report whether it is itself even or odd.
Since the time this idea first sprung to mind I have periodically searched the internet for a formal proof, without success.
I know that a proof must either exist, or should be easily constructed given the following:
The sum of a finite number of even integers is even.
The sum of two integers is odd $iff$ one summand is odd, and even otherwise.
I can think of at least three, rather inelegant, informal proofs, with the simplest being:
Successive odd values can be paired together, if all pair up (even number of odd values) then the sum would be even (from 1). If one value remains unpaired then it is odd (from 2).
I would like to see an elegant, or at least formal, proof of this rather simple idea.