#!/usr/bin/ruby

#
## https://rosettacode.org/wiki/Pernicious_numbers#Sidef
#

func is_pernicious(n) {
    var c = 2693408940;  # primes < 32 as set bits
    while (n > 0) { c >>= 1; n &= (n - 1) }
    c & 1;
}

var (i, *p) = 0;
while (p.len < 25) {
    p << i if is_pernicious(i);
    ++i;
}

say p.join(' ');

var (i, *p) = 888888877;
while (i < 888888888) {
    p << i if is_pernicious(i);
    ++i;
}

say p.join(' ');
