Idoneal numbers: Difference between revisions

Added Algol 68
(→‎{{header|jq}}: NDEBUG timing)
(Added Algol 68)
Line 20:
;* [[oeis:A000926|OEIS:A000926 - Euler's "numerus idoneus" (or "numeri idonei", or idoneal, or suitable, or convenient numbers)]]
 
 
=={{header|ALGOL 68}}==
<syntaxhighlight lang="algol68">
BEGIN # find idoneal numbers - numbers that cannot be written as ab + bc + ac #
# where 0 < a < b < c #
# there are 65 known idoneal numbers #
INT count := 0;
FOR n WHILE count < 65 DO
BOOL idoneal := TRUE;
FOR a TO n - 2 WHILE count < 65 AND idoneal DO
FOR b FROM a + 1 TO n - 1
WHILE INT ab = a * b;
ab < n AND count < 65 AND idoneal
DO
FOR c FROM b + 1 TO n
WHILE INT bc = b * c, ac = a * c;
INT sum = ab + bc + ac;
sum <= n
AND count < 65
AND ( idoneal := sum /= n )
DO SKIP OD
OD
OD;
IF idoneal THEN
print( ( " ", whole( n, -4 ) ) );
IF ( count +:= 1 ) MOD 13 = 0 THEN print( ( newline ) ) FI
FI
OD
END
</syntaxhighlight>
{{out}}
<pre>
1 2 3 4 5 6 7 8 9 10 12 13 15
16 18 21 22 24 25 28 30 33 37 40 42 45
48 57 58 60 70 72 78 85 88 93 102 105 112
120 130 133 165 168 177 190 210 232 240 253 273 280
312 330 345 357 385 408 462 520 760 840 1320 1365 1848
</pre>
 
=={{header|BASIC}}==
3,037

edits