Pernicious Number Calculator

Check whether the number of ones in the binary form of n is itself a prime number.

Math and PercentUpdated 2026-11-182 min read
Pernicious Number Calculator
A whole number from 0 to 1,000,000,000,000.
Ones in binary form
...
Binary expansion...
Classification...

What it does

A pernicious number is a positive integer whose binary expansion contains a prime number of ones. The sequence begins 3, 5, 6, 7, 9, 10, 11, 12 and 13. Three has two binary ones, and two is prime, so it is pernicious.

The name was coined by John Conway, who used it in a proof that every positive integer has a multiple that is pernicious. The property combines a bitwise count with an ordinary primality test.

This page converts the input to binary, counts the ones and tests that small count for primality. The binary string is printed so the count can be verified independently.

Because the count is small even for large inputs, the primality test is immediate. A step guard and a bounded binary conversion keep the whole computation safe.

The input limit is one trillion, which keeps the printed bit string manageable and the result exact.

How to use

  1. Enter a whole number n from 0 to 1,000,000,000,000.
  2. Read the classification in the main result box.
  3. Check the binary expansion beside it.
  4. Count the ones and test that number for primality.
  5. The default n = 3 reproduces the worked example.
  6. Try n = 7 to see three binary ones, which is also prime.

Formula

n is pernicious when the number of ones in the base 2 expansion of n is prime
n
The nonnegative integer being classified.
binary
The base 2 expansion of n.
ones
The count of binary ones, which must be prime.

Counts of zero and one are not prime, so 0 and 1 fail. Counts of two, three, five and seven are the most common qualifying values for modest inputs. The primality test is exact.

Worked example

Example: n = 3

The page opens with n = 3.

  1. Write 3 in binary: it is 11.
  2. Count the ones: there are two.
  3. Two is a prime number.
  4. The tool reports ones 2, binary 11, and Pernicious.
  5. For 7 the binary form is 111 with three ones, also prime.
  6. For 4 the binary form is 100 with one one, which is not prime.

Reference table

Pernicious numbers
nBinaryOnesPernicious
000No
111No
3112Yes
51012Yes
71113Yes
810001No

Limits

  • Only nonnegative integers are accepted.
  • Inputs above one trillion are rejected to keep the bit string short.
  • The classification is base 2 specific.
  • The tool gives a verdict, not the position in the sequence.

Common mistakes

  • Counting decimal digits instead of binary digits.
  • Treating a count of one as prime.
  • Assuming every number with two binary ones is small.
  • Confusing this with evil or odious numbers.
  • Including leading zeros in the count.

Try it yourself

Quick checks. Answers sit tucked under each question.

Is 3 pernicious?

Yes. Its binary form 11 has two ones, and two is prime.

Is 8 pernicious?

No. Its binary form 1000 has one one, which is not prime.

Is 7 pernicious?

Yes. Its binary form 111 has three ones.

Questions

Who named pernicious numbers?

The name is attributed to John Conway.

What is the connection to multiples?

Conway used the property in proving that every positive integer has a pernicious multiple.

Which counts qualify?

Prime counts such as 2, 3, 5 and 7.

Is one pernicious?

No, because its binary form has one one and one is not prime.

Are results exact?

Yes, binary conversion and primality are exact.

What input range is accepted?

Whole numbers from 0 through 1,000,000,000,000.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.