Jordan-Pólya numbers: Difference between revisions

Faster XPL0 example.
(Added XPL0 example.)
(Faster XPL0 example.)
Line 118:
 
=={{header|XPL0}}==
Simple-minded brute force. 3220 seconds on Pi4. No bonus (yet).
<syntaxhighlight lang "XPL0">int Factorials(131+12);
 
func IsJPNum(N0);
int N0;
int N, Limit, I, Q;
[Limit:= 7; N:= N0;
FN:= 1N0;
loop [I:= Limit;
loop [Q:= N / Factorials(I);
Line 143 ⟶ 144:
 
int F, N, C, SN;
[Factorials(0)F:= 1;
F:= 1;
for N:= 1 to 12 do
[F:= F*N;
Line 151:
Text(0, "First 50 Jordan-Polya numbers:^m^j");
Format(5, 0);
RlOut(0, 1.); \handle odd number exception
NC:= 1; CN:= 02;
loop [if IsJPNum(N) then
[C:= C+1;
Line 160 ⟶ 161:
SN:= N;
];
N:= N+12;
if N >= 100_000_000 then quit;
];
295

edits