Cubic special primes: Difference between revisions

Added XPL0 example.
m (Thundergnat moved page Cubic Special Primes to Cubic special primes: capitalization policy)
(Added XPL0 example.)
Line 736:
 
23 such primes found.
</pre>
 
=={{header|XPL0}}==
<lang XPL0>func IsPrime(N); \Return 'true' if N is prime
int N, I;
[if N <= 2 then return N = 2;
if (N&1) = 0 then \even >2\ return false;
for I:= 3 to sqrt(N) do
[if rem(N/I) = 0 then return false;
I:= I+1;
];
return true;
];
 
int N, C, T;
[N:= 2;
repeat C:= 1;
loop [T:= N + C*C*C;
if IsPrime(T) then
[IntOut(0, N);
ChOut(0, ^ );
N:= T;
quit;
]
else C:= C+1;
];
until N > 15000;
]</lang>
 
{{out}}
<pre>
2 3 11 19 83 1811 2027 2243 2251 2467 2531 2539 3539 3547 4547 5059 10891 12619 13619 13627 13691 13907 14419
</pre>
772

edits