Wagstaff primes: Difference between revisions

Added Gambas
(Added Gambas)
Line 554:
9: 31 => 715,827,883
10: 43 => 2,932,031,007,403</pre>
 
=={{header|Gambas}}==
{{trans|FreeBASIC}}
<syntaxhighlight lang="vbnet">Use "isprime.bas"
 
Public Sub Main()
Wagstaff(10)
End
 
Sub Wagstaff(num As Long)
 
Dim pri As Long = 1
Dim wcount As Long = 0
Dim wag As Long
 
While wcount < num
pri = pri + 2
If isPrime(pri) Then
wag = (2 ^ pri + 1) / 3
If isPrime(wag) Then
wcount += 1
Print Format$(Str(wcount), "###"); ": "; Format$(Str(pri), "###"); " => "; Int(wag)
End If
End If
Wend
 
End Sub</syntaxhighlight>
{{out}}
<pre>Similar to FreeBASIC entry.</pre>
 
=={{header|Go}}==
2,127

edits