TOPICS
Search

Parity


The parity of an integer is its attribute of being even or odd. Thus, it can be said that 6 and 14 have the same parity (since both are even), whereas 7 and 12 have opposite parity (since 7 is odd and 12 is even).

A different type of parity of an integer n is defined as the sum s_2(n) of the bits in binary representation, i.e., the digit count N_1(n), computed modulo 2. So, for example, the number 10=1010_2 has two 1s in its binary representation and hence has parity 2 (mod 2), or 0. The parities of the first few integers (starting with 0) are therefore 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, ... (OEIS A010060), as summarized in the following table.

N binary parity N binary parity
1 1 1 11 1011 1
2 10 1 12 1100 0
3 11 0 13 1101 1
4 100 1 14 1110 1
5 101 0 15 1111 0
6 110 0 16 10000 1
7 111 1 17 10001 0
8 1000 1 18 10010 0
9 1001 0 19 10011 1
10 1010 0 20 10100 0

A generating function for parity is given by

The constant generated by interpreting the sequence of parity digits as a binary fraction 0.011010011..._2 is called the Thue-Morse constant.

The parity function obeys the sum identity

for any n. For example, for n=2 and r=0,

1-ひく4-ひく9+たす16-ひく25+たす36+たす49-ひく64=0.
(3)

See also

Binary, Digit Count, Digit Sum, Even Number, Evil Number, Odd Number, Parity Check Matrix, Thue-Morse Constant

Explore with Wolfram|Alpha

References

Commission on Mathematics of the College Entrance Examination Board. Informal Deduction in Algebra: Properties of Odd and Even Numbers. Princeton, NJ, 1959.Gardner, M. "Parity Checks." Ch. 8 in The Sixth Book of Mathematical Games from Scientific American. Chicago, IL: University of Chicago Press, pp. 71-78, 1984.Sloane, N. J. A. Sequence A010060 in "The On-Line Encyclopedia of Integer Sequences."

Referenced on Wolfram|Alpha

Parity

Cite this as:

Weisstein, Eric W. "Parity." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/Parity.html

Subject classifications

AltStyle によって変換されたページ (->オリジナル) /