Totient function: Difference between revisions
→{{header|ALGOL 68}}: Avoid line wrap
(→{{header|Lua}}: Added alternative version) |
(→{{header|ALGOL 68}}: Avoid line wrap) |
||
Line 664:
FOR n TO 25 DO
INT tn = totient( n );
print( ( whole( n, -2 ), ": ", whole( tn, -5
, IF tn = n - 1 AND tn /= 0 THEN " n is prime" ELSE "" FI, newline
)
)
OD;
# use the totient function to count primes #
Line 714 ⟶ 717:
There are 9592 primes below 100 000
</pre>
=={{header|ALGOL-M}}==
The GCD approach is straight-forward and easy to follow, but is not particularly efficient.
|