28 lines
508 B
Plaintext
28 lines
508 B
Plaintext
Procedure.i cntDiv(n.i)
|
|
Define.i i, count
|
|
If n < 2 : ProcedureReturn 1 : EndIf
|
|
count = 2 : i = 2
|
|
While i <= n / 2
|
|
If n % i = 0 : count + 1 : EndIf
|
|
i + 1
|
|
Wend
|
|
ProcedureReturn count
|
|
EndProcedure
|
|
|
|
; - - - MAIN - - -
|
|
Define.i n = 1, d, maxDiv = 0, count = 0
|
|
If OpenConsole("")
|
|
PrintN("The first 20 anti-primes are: ")
|
|
While count < 20
|
|
d = cntDiv(n)
|
|
If d > maxDiv
|
|
Print(Str(n) + " ")
|
|
maxDiv = d : count + 1
|
|
EndIf
|
|
n + 1
|
|
Wend
|
|
PrintN("")
|
|
Input()
|
|
EndIf
|
|
End 0
|