35 lines
597 B
Plaintext
35 lines
597 B
Plaintext
print "Pop count (3^x): "
|
|
|
|
for i = 0 to 29
|
|
print population(3^i);
|
|
next
|
|
print "\n"
|
|
|
|
print "Evil: "
|
|
EvilOdious(30)
|
|
print "\n"
|
|
|
|
print "Odious: "
|
|
EvilOdious(30, 1)
|
|
print "\n"
|
|
|
|
sub EvilOdious(limit, type)
|
|
local i, count, eo
|
|
|
|
repeat
|
|
eo = mod(population(i), 2)
|
|
if (type and eo) or (not type and not eo) count = count + 1 : print i;
|
|
i = i + 1
|
|
until(count = limit)
|
|
end sub
|
|
|
|
sub population(number)
|
|
local i, binary$, popul
|
|
|
|
binary$ = bin$(number)
|
|
for i = 1 to len(binary$)
|
|
popul = popul + val(mid$(binary$, i, 1))
|
|
next
|
|
return popul
|
|
end sub
|