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
<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
ELSE▼
print( ( whole( sum p, -16 ), whole( n, -10 ), whole( m, -11 ), newline ) );
count +:= 1;
IF count
WHILE is prime( num c +:= 1 ) DO SKIP OD;
sum c +:= num c;
m +:= 1
FI
FI;
DO SKIP OD
END
|