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.

NbinaryparityNbinaryparity
1111110111
21011211000
31101311011
410011411101
510101511110
6110016100001
7111117100010
81000118100100
91001019100111
101010020101000

A generating function for parity is given by

 1/2(1/(1-x)-product_(k=0)^infty1-x^(2^k))=x+x^2+x^4+x^7+....
(1)

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

 sum_(k=0)^(2^(n+1)-1)(-1)^(P(k))(k+r)^n=0
(2)

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 Web Resource. https://mathworld.wolfram.com/Parity.html

Subject classifications