In number theory, a pernicious number is a positive integer where the Hamming weight (or digit sum) of its binary representation is prime.
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 the OEIS).
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. So each power of two has a Hamming weight of one, and one is not considered a prime.Every number of the form 2n + 1 with n>0, including every Fermat number, is a pernicious number. This is because the sum of the digits in binary form 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 (although sometimes Mersenne numbers are defined as 2n − 1 for any natural number n).Odious numbers are numbers with an odd number of 1s in their binary expansion (sequence A000069 in the OEIS).Evil numbers are numbers with an even number of 1s in their binary expansion (sequence A001969 in the OEIS).