Double Twin Primes: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Raku}}: technically these are) |
(Added XPL0 example.) |
||
Line 64: | Line 64: | ||
821 823 827 829 |
821 823 827 829 |
||
done... |
done... |
||
</pre> |
|||
=={{header|XPL0}}== |
|||
<syntaxhighlight lang "XPL0">func IsPrime(N); \Return 'true' if odd N is prime |
|||
int N, D; |
|||
[for D:= 3 to sqrt(N) do |
|||
[if rem(N/D) = 0 then return false; |
|||
D:= D+1; |
|||
]; |
|||
return true; |
|||
]; |
|||
int N; |
|||
[N:= 3; |
|||
repeat if IsPrime(N) then |
|||
if IsPrime(N+2) then |
|||
if IsPrime(N+6) then |
|||
if IsPrime(N+8) then |
|||
[IntOut(0, N); ChOut(0, ^ ); |
|||
IntOut(0, N+2); ChOut(0, ^ ); |
|||
IntOut(0, N+6); ChOut(0, ^ ); |
|||
IntOut(0, N+8); CrLf(0); |
|||
]; |
|||
N:= N+2; |
|||
until N >= 1000-8; |
|||
]</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
5 7 11 13 |
|||
11 13 17 19 |
|||
101 103 107 109 |
|||
191 193 197 199 |
|||
821 823 827 829 |
|||
</pre> |
</pre> |