Jordan-Pólya numbers: Difference between revisions
Faster XPL0 example.
(Added XPL0 example.) |
(Faster XPL0 example.) |
||
Line 118:
=={{header|XPL0}}==
Simple-minded brute force.
<syntaxhighlight lang "XPL0">int Factorials(
func IsJPNum(N0);
int N0;
int N, Limit, I, Q;
[Limit:= 7
loop [I:= Limit;
loop [Q:= N / Factorials(I);
Line 143 ⟶ 144:
int F, N, C, SN;
[
▲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
loop [if IsJPNum(N) then
[C:= C+1;
Line 160 ⟶ 161:
SN:= N;
];
N:= N+
if N >= 100_000_000 then quit;
];
|