Extreme primes: Difference between revisions
Content deleted Content added
Added XPL0 example. |
Added FreeBasic |
||
Line 7:
Find and display the first '''30 p extreme prime''' number on this page.
<br><br>
=={{header|FreeBASIC}}==
<syntaxhighlight lang="vb">#include "isprime.bas"
Dim As Integer limit = 2000, n, c = 0
Dim As Integer Primes()
For n = 1 To limit
If isPrime(n) Then
c += 1
Redim Preserve Primes(n)
Primes(c) = n
End If
Next n
Print "The first 30 extreme primes are:"
Dim As Integer sum = 0, row = 0
For n = 1 To Ubound(Primes)
sum += Primes(n)
If isPrime(sum) Then
row += 1
Print Using "########"; sum;
If row Mod 10 = 0 Then Print
End If
Next n
Sleep</syntaxhighlight>
{{out}}
<pre>Similar to Ring entry.</pre>
=={{header|Ring}}==
<syntaxhighlight lang="ring">
|