28 lines
543 B
Plaintext
28 lines
543 B
Plaintext
Procedure.b isGiuga(m.i)
|
|
Define.i n = m, f = 2, l = Sqr(n)
|
|
While #True
|
|
If Mod(n, f) = 0:
|
|
If Mod(((m / f) - 1), f) <> 0: ProcedureReturn #False: EndIf
|
|
n = n / f
|
|
If f > n: ProcedureReturn #True: EndIf
|
|
Else
|
|
f + 1
|
|
If f > l: ProcedureReturn #False: EndIf
|
|
EndIf
|
|
Wend
|
|
EndProcedure
|
|
|
|
OpenConsole()
|
|
Define.i n = 3, c = 0, limit = 4
|
|
Print("The first " + Str(limit) + " Giuga numbers are: ")
|
|
Repeat
|
|
If isGiuga(N):
|
|
c + 1
|
|
Print(Str(n) + " ")
|
|
EndIf
|
|
n + 1
|
|
Until c = limit
|
|
|
|
Input()
|
|
CloseConsole()
|