Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
44
Task/Blum-integer/Gambas/blum-integer.gambas
Normal file
44
Task/Blum-integer/Gambas/blum-integer.gambas
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
Public Prime1 As Integer
|
||||
|
||||
Public Sub Main()
|
||||
|
||||
Dim n As Integer = 3, c As Integer = 0, Prime2 As Integer
|
||||
|
||||
Print "The first 50 Blum integers:"
|
||||
Do
|
||||
If isSemiprime(n) Then
|
||||
If Prime1 Mod 4 = 3 Then
|
||||
Prime2 = n / Prime1
|
||||
If (Prime2 <> Prime1) And (Prime2 Mod 4 = 3) Then
|
||||
c += 1
|
||||
If c <= 50 Then
|
||||
Print Format$(n, "####");
|
||||
If c Mod 10 = 0 Then Print
|
||||
End If
|
||||
If c >= 26828 Then
|
||||
Print "\nThe 26828th Blum integer is: "; n
|
||||
Break
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
n += 2
|
||||
Loop
|
||||
|
||||
End
|
||||
|
||||
Function isSemiprime(n As Integer) As Boolean
|
||||
|
||||
Dim d As Integer = 3, c As Integer = 0
|
||||
While d * d <= n
|
||||
While n Mod d = 0
|
||||
If c = 2 Then Return False
|
||||
n /= d
|
||||
c += 1
|
||||
Wend
|
||||
d += 2
|
||||
Wend
|
||||
Prime1 = n
|
||||
Return c = 1
|
||||
|
||||
End Function
|
||||
Loading…
Add table
Add a link
Reference in a new issue