27 lines
700 B
Text
27 lines
700 B
Text
Function isPrime(Byval num As Ulongint) As Boolean
|
|
If num < 2 Then Return False
|
|
If num Mod 2 = 0 Then Return num = 2
|
|
If num Mod 3 = 0 Then Return num = 3
|
|
Dim d As Uinteger = 5
|
|
While d * d <= num
|
|
If num Mod d = 0 Then Return False Else d += 2
|
|
Wend
|
|
Return True
|
|
End Function
|
|
|
|
Sub Wagstaff(num As Ulongint)
|
|
Dim As Ulongint pri = 1, wcount = 0, wag
|
|
While wcount < num
|
|
pri += 2
|
|
If isPrime(pri) Then
|
|
wag = (2 ^ pri + 1) / 3
|
|
If isPrime(wag) Then
|
|
wcount += 1
|
|
Print Using "###: ### => ##,###,###,###,###"; wcount; pri; wag
|
|
End If
|
|
End If
|
|
Wend
|
|
End Sub
|
|
|
|
Wagstaff(10)
|
|
Sleep
|