# Pernicious number

In number theory, a pernicious number is a positive integer where the Hamming weight (or digit sum) of its binary representation is prime.

## Examples

The first pernicious number is 3, since 3 = 112 and 1 + 1 = 2, which is a prime. The next pernicious number is 5, since 5 = 1012, followed by 6, 7 and 9 (sequence A052294 in OEIS).

## Properties

• No power of two is a pernicious number. This is trivially true, because powers of two in binary form are represented as a one followed by zeros.
• Every number of the form 2n + 1 with n>0, is a pernicious number. This is because the sum is 2, which is a prime number.
• Every even perfect number is a pernicious number. This is based on the fact that every even perfect number can be represented as 2p−1(2p − 1) with p a prime. Owing to this form, every even perfect number is represented in binary as p ones followed by p − 1 zeros.
• A number of the form 2p − 1 with prime p is a pernicious number known as a Mersenne number.