Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Giuga-numbers/FreeBASIC/giuga-numbers.basic
Normal file
20
Task/Giuga-numbers/FreeBASIC/giuga-numbers.basic
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Function isGiuga(m As Uinteger) As Boolean
|
||||
Dim As Uinteger n = m, f = 2, l = Sqr(n)
|
||||
Do
|
||||
If n Mod f = 0 Then
|
||||
If ((m / f) - 1) Mod f <> 0 Then Return False
|
||||
n /= f
|
||||
If f > n Then Return True
|
||||
Else
|
||||
f += 1
|
||||
If f > l Then Return False
|
||||
End If
|
||||
Loop
|
||||
End Function
|
||||
|
||||
Dim As Uinteger n = 3, c = 0, limit = 4
|
||||
Print "The first "; limit; " Giuga numbers are: ";
|
||||
Do
|
||||
If isGiuga(n) Then c += 1: Print n; " ";
|
||||
n += 1
|
||||
Loop Until c = limit
|
||||
Loading…
Add table
Add a link
Reference in a new issue