Extreme primes: Difference between revisions
Content added Content deleted
(Added XPL0 example.) |
|||
Line 79: | Line 79: | ||
61,027 66,463 70,241 86,453 102,001 109,147 |
61,027 66,463 70,241 86,453 102,001 109,147 |
||
116,533 119,069 121,631 129,419 132,059 263,171 |
116,533 119,069 121,631 129,419 132,059 263,171 |
||
</pre> |
|||
=={{header|XPL0}}== |
|||
<syntaxhighlight lang "XPL0">include xpllib; \for IsPrime and RlOutC |
|||
int C, N, S; |
|||
[Text(0, "The first 30 extreme primes are:^m^j"); |
|||
Format(7,0); |
|||
C:= 0; N:= 2; S:= 0; |
|||
loop [if IsPrime(N) then |
|||
[S:= S+N; |
|||
if IsPrime(S) then |
|||
[C:= C+1; |
|||
RlOutC(0, float(S)); |
|||
if rem(C/6) = 0 then CrLf(0); |
|||
if C >= 30 then quit; |
|||
]; |
|||
]; |
|||
N:= N+1; |
|||
]; |
|||
]</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
The first 30 extreme primes are: |
|||
2 5 17 41 197 281 |
|||
7,699 8,893 22,039 24,133 25,237 28,697 |
|||
32,353 37,561 38,921 43,201 44,683 55,837 |
|||
61,027 66,463 70,241 86,453 102,001 109,147 |
|||
116,533 119,069 121,631 129,419 132,059 263,171 |
|||
</pre> |
</pre> |