function tobin$(num) bin$ = "" if num = 0 then bin$ = "0" while num >= 1 num = num / 2 X$ = str$(num) D$ = "": F$ = "" for i = 1 to len(X$) L$ = mid$(X$, i, 1) if L$ <> "." then D$ = D$ + L$ else F$ = F$ + right$(X$, len(X$) - i) exit for end if next i if F$ = "" then B$ = "0" else B$ = "1" bin$ = bin$ + B$ num = val(D$) wend B$ = "" for i = len(bin$) to 1 step -1 B$ = B$ + mid$(bin$, i, 1) next i tobin$ = B$ end function function population(number) popul = 0 'digito$ = tobin$(number) 'print tobin$(number) for i = 1 to len(tobin$(number)) popul = popul + val(mid$(tobin$(number), i, 1)) next i population = popul end function sub evilodious limit, tipo i = 0 cont = 0 while 1 eo = (population(i) mod 2) if (tipo and eo = 1) or ((not(tipo) and not(eo)) = 1) then cont = cont + 1: print i; " "; end if i = i + 1 if cont = limit then exit while wend end sub print "Pop cont (3^x): "; for i = 0 to 14 print population(3 ^ i); " "; next i print print "Evil numbers: "; call evilodious 15, 0 print print "Odious numbers: "; call evilodious 15, 1 end