Equal prime and composite sums: Difference between revisions

→‎{{header|ALGOL 68}}: Slight simplification
(Added Lua)
(→‎{{header|ALGOL 68}}: Slight simplification)
Line 33:
 
=={{header|ALGOL 68}}==
{{Trans|XPL0|With a fewcoup[le of tweaks}}
<syntaxhighlight lang="algol68">
BEGIN # find n and m where the sums of the first n primes and first m #
Line 68:
m +:= 1
FI;
IF sum p /= sum c THEN TRUE # continue the loop #
ELSE
print( ( whole( sum p, -16 ), whole( n, -10 ), whole( m, -11 ), newline ) );
count +:= 1;
IF count >=< 8 THEN FALSE # loop stops here #
ELSE
WHILE is prime( num c +:= 1 ) DO SKIP OD;
sum c +:= num c;
m +:= 1;
TRUE # continue the loop #
FI
FI;
ELSEcount < 8
DO SKIP OD
END
3,038

edits