31 lines
558 B
Plaintext
31 lines
558 B
Plaintext
Procedure.i mobius(n)
|
|
If n = 1:
|
|
ProcedureReturn 1
|
|
EndIf
|
|
For d = 2 To Int(Sqr(n))
|
|
If Mod(n, d) = 0:
|
|
If Mod(n, d * d) = 0:
|
|
ProcedureReturn 0
|
|
EndIf
|
|
ProcedureReturn -mobius(n / d)
|
|
EndIf
|
|
Next d
|
|
ProcedureReturn -1
|
|
EndProcedure
|
|
|
|
OpenConsole()
|
|
outstr$ = " . "
|
|
For i = 1 To 200
|
|
If mobius(i) >= 0:
|
|
outstr$ = outstr$ + " "
|
|
EndIf
|
|
outstr$ = outstr$ + Str(mobius(i)) + " "
|
|
If Mod(i, 10) = 9:
|
|
PrintN(outstr$)
|
|
outstr$ = ""
|
|
EndIf
|
|
Next i
|
|
|
|
PrintN(#CRLF$ + "Press ENTER to exit"): Input()
|
|
CloseConsole()
|