← Previous Next →

Pernicious numbers

Created by Julien Palard

Instructions

Build a program taking no parameter.

The program will print the pernicious numbers in the range(222281, 222381)

This exercises may be hard if you don't understand what a pernicious number is, and is not mandatory to continue, so you can skip it.

One number per line, nothing else.

If the exercice were to be in the range(100, 110) should print:

$ ./solution.py
100
103
104
107
109

Because:

  • 100 is 1100100 in base 2, 3 ones: prime number of ones.
  • 103 is 1100111 in base 2, 5 ones: prime number of ones.
  • 104 is 1101000 in base 2, 3 ones: prime number of ones.
  • 107 is 1101011 in base 2, 5 ones: prime number of ones.
  • 109 is 1101101 in base 2, 5 ones: prime number of ones.

Results