36 lines
718 B
Plaintext
36 lines
718 B
Plaintext
print "Pop cont (3^x): ";
|
|
for i = 0 to 29
|
|
print population(3^i); " "; #los últimos números no los muestra correctamente
|
|
next i
|
|
|
|
print : print
|
|
print "Evil numbers: ";
|
|
call EvilOdious(30, 0)
|
|
|
|
print : print
|
|
print "Odious numbers: ";
|
|
call EvilOdious(30, 1)
|
|
end
|
|
|
|
subroutine EvilOdious(limit, type)
|
|
i = 0 : cont = 0
|
|
|
|
do
|
|
eo = (population(i) mod 2)
|
|
if (type and eo) or (not type and not eo) then
|
|
cont += 1 : print i; " ";
|
|
end if
|
|
i += 1
|
|
until (cont = limit)
|
|
end subroutine
|
|
|
|
function population(number)
|
|
popul = 0
|
|
|
|
binary$ = tobinary(number)
|
|
for i = 1 to length(binary$)
|
|
popul += int(mid(binary$, i, 1))
|
|
next i
|
|
return popul
|
|
end function
|