Odious number explained

In number theory, an odious number is a positive integer that has an odd number of 1s in its binary expansion. Non-negative integers that are not odious are called evil numbers.

In computer science, an odious number is said to have odd parity.

Examples

The first odious numbers are:

Properties

If

a(n)

denotes the

n

th odious number (with

a(0)=1

), then for all

n

,

a(a(n))=2a(n)

.

Every positive integer

n

has an odious multiple that is at most

n(n+4)

. The numbers for which this bound is tight are exactly the Mersenne numbers with even exponents, the numbers of the form

n=22r-1

, such as 3, 15, 63, etc. For these numbers, the smallest odious multiple is exactly

n(n+4)=24r+22r+1-3

.

Related sequences

The odious numbers give the positions of the nonzero values in the Thue–Morse sequence. Every power of two is odious, because its binary expansion has only one nonzero bit. Except for 3, every Mersenne prime is odious, because its binary expansion consists of an odd prime number of consecutive nonzero bits.

Non-negative integers that are not odious are called evil numbers. The partition of the non-negative integers into the odious and evil numbers is the unique partition of these numbers into two sets that have equal multisets of pairwise sums.