26 lines
649 B
Text
26 lines
649 B
Text
$ 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;
|