Parity
https://en.wikipedia.org/wiki/Parity_(mathematics)
Parity is the property of integers, β€
Parity determines an integer's inclusion in "even" or "odd" categories
An integer is even if it is divisible by 2, else it is odd
formally, an even integer is the one that can be expressed as
n = 2k
formally, an odd integer is the one that can be expressed as
n = 2k + 1
According to the formal definition, with k β β€
, an even integer is the one that can be expressed in the form n=2k
. An odd integer is the one that can be expressed either as n=2k+1
or n=2k-1
.
To express odd natural numbers, where k β β
, only the form 2k+1
can be used if 0 β β (otherwise, we'd get -1 for k=0). However, if 0 β β then only the form 2k-1
can be used (otherwise, we couldn't get 1 at all).
In numeral systems with an even base, a number is even if its LSD is even.
In an odd base, the number is even according to the sum of its digits - it is even iff the sum of its digits is even.
Last updated
Was this helpful?