Idoneal numbers: Difference between revisions

→‎{{header|ALGOL 68}}: Further simplification - don't need a loop to find c
(→‎{{header|Action!}}: Slight simplification)
(→‎{{header|ALGOL 68}}: Further simplification - don't need a loop to find c)
Line 84:
 
=={{header|ALGOL 68}}==
Note, AND does not shortcut in Algol 68.
<syntaxhighlight lang="algol68">
BEGIN # find idoneal numbers - numbers that cannot be written as ab + bc + ac #
Line 95 ⟶ 96:
FOR b FROM a + 1 TO n - 1
WHILE INT ab = a * b;
INT c = ( n - ab +) OVER ( a + b ) < n AND idoneal;
DO INT sum = ab + ( c * ( b + a ) );
FOR c FROMsum b + 1 TO<= n
AND ( WHILE INT sumidoneal := ab + ( c * (<= b +OR asum )/= n );
DO SKIP sum <= nOD
AND ( idoneal := sum /= n )
DO SKIP OD
OD
OD;
IF idoneal THEN
3,037

edits