*** Welcome to piglix ***

Parity (mathematics)


Parity is a mathematical term that describes the property of an integer's inclusion in one of two categories: even or odd. An integer is even if it is 'evenly divisible' by two (the old-fashioned term "evenly divisible" is now almost always shortened to "divisible") and odd if it is not even. For example, 6 is even because there is no remainder when dividing it by 2. By contrast, 3, 5, 7, 21 leave a remainder of 1 when divided by 2. Examples of even numbers include −4, 0, 8, and 1738. In particular, zero is an even number. Some examples of odd numbers are −5, 3, 9, and 73. Parity does not apply to non-integer numbers.

A formal definition of an even number is that it is an integer of the form n = 2k, where k is an integer; it can then be shown that an odd number is an integer of the form n = 2k + 1. This classification applies only to integers, i.e., non-integers like 1/2, 4.201, or infinity are neither even nor odd.

The sets of even and odd numbers can be defined as following:

A number (i.e., integer) expressed in the decimal numeral system is even or odd according to whether its last digit is even or odd. That is, if the last digit is 1, 3, 5, 7, or 9, then it is odd; otherwise it is even. The same idea will work using any even base. In particular, a number expressed in the binary numeral system is odd if its last digit is 1 and even if its last digit is 0. In an odd base, the number is even according to the sum of its digits – it is even if and only if the sum of its digits is even.

The following laws can be verified using the properties of divisibility. They are a special case of rules in modular arithmetic, and are commonly used to check if an equality is likely to be correct by testing the parity of each side. As with ordinary arithmetic, multiplication and addition are commutative and associative in modulo 2 arithmetic, and multiplication is distributive over addition. However, subtraction in modulo 2 is identical to addition, so subtraction also possesses these properties, which is not true for normal integer arithmetic.


...
Wikipedia

...