Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Anti-primes/PureBasic/anti-primes.basic
Normal file
27
Task/Anti-primes/PureBasic/anti-primes.basic
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue