A   pernicious number   is a positive integer whose   population count   is a prime.

The   population count   is the number of   ones   in the binary representation of a non-negative integer.



Example
22   (which is   10110   in binary)   has a population count of   3,   which is prime,   and therefore

22   is a pernicious number.



Task
 display the first   25   pernicious numbers   (in decimal).
 display all pernicious numbers between   888,888,877   and   888,888,888   (inclusive).
 display each list of integers on one line   (which may or may not include a title).


See also
 Sequence   A052294 pernicious numbers on The On-Line Encyclopedia of Integer Sequences.
 Rosetta Code entry   population count, evil numbers, odious numbers.


$ include "seed7_05.s7i";
 
const set of integer: primes is {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61};
 
const func integer: popcount (in integer: number) is
  return card(bitset(number));
 
const proc: main is func
  local
    var integer: num is 0;
    var integer: count is 0;
  begin
    for num range 0 to integer.last until count >= 25 do
      if popcount(num) in primes then
        write(num <& " ");
	incr(count);
      end if;
    end for;
    writeln;
    for num range 888888877 to 888888888 do
      if popcount(num) in primes then
        write(num <& " ");
      end if;
    end for;
    writeln;
  end func;