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