Parity
Parity is the classification of an integer or bit string as even or odd according to whether its value is divisible by two.
Quantum Programming in Depth
Parity is the property of being even or odd, here determined for a computational-basis state by the parity of its bit values.
- How it is used
- Classifies basis states and extracts correlations from quantum superpositions through joint measurements.
- How deep it goes
- Defines parity, explains state-preserving measurement, and implements testing, but stops short of general measurement theory.
- Examples
- Uses two-qubit parity states, Q# measurement operations, state-preservation tests, and an N-queens oracle.
- What you can do after
- Apply parity measurements to identify a state class while preserving its superposition.
Learn C++ by Example
Parity is the classification of an integer as odd or even.
- How it is used
- Classifies generated numbers as odd or even while demonstrating transformations and output in a C++ example.
- How deep it goes
- Defines modulo-2 testing and demonstrates it in a ranges pipeline, without developing a formal theory of parity.
- Examples
- Uses triangle numbers, dot-and-star markers, repeating output, and final-digit frequency counts.
- What you can do after
- Apply it via C++ remainder checks and ranges transformations to label numbers as odd or even.
Related concepts
- binary stringuses · A binary string is a finite, ordered sequence of binary digits, each having the value zero or one.
- parity measurementmeasured by · A parity measurement is a quantum measurement that determines whether the combined bit values of a computational-basis state have even or odd parity.
- ancillary qubitused by · An ancillary qubit is an additional qubit used to store intermediate information or enable operations during a quantum computation.
- parity trickused by · The parity trick checks whether counts satisfy a constraint by computing their values modulo two instead of counting them exactly.
- quantum measurementmeasured by · Quantum measurement is the process of obtaining a classical outcome from a quantum system according to probabilities determined by its state, generally changing that state.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

