Factorial primes: Difference between revisions
→{{header|ALGOL 68}}: Simplified also make it more DRY and less WET
(Added Sidef) |
(→{{header|ALGOL 68}}: Simplified also make it more DRY and less WET) |
||
Line 31:
=={{header|ALGOL 68}}==
Basic task. Assumes LONG INT is at least 64 bits.
<syntaxhighlight lang="algol68">
BEGIN # find some factorial primes - primes that are f - 1 or f + 1 #
# for some factorial f #
Line 43 ⟶ 44:
prime
FI;
# end of code based on the primality by trial
, newline▼
)▼
); ▼
LONG INT f := 1;
INT fp count := 0;
FOR n WHILE fp count < 10 DO
f *:= n;
FOR offset FROM -1
IF LONG INT fp = f + offset;
OD
END
{{out}}
<pre>
|