Anonymous user
Factors of a Mersenne number: Difference between revisions
→[[Trial_factoring_of_a_Mersenne_number#ALGOL 68]]: link to "pow_mod.a68" prelude
m (oct...) |
(→[[Trial_factoring_of_a_Mersenne_number#ALGOL 68]]: link to "pow_mod.a68" prelude) |
||
Line 21:
{{trans|Fortran}}
{{works with|ALGOL 68|Standard -
{{works with|ALGOL 68G|Any - tested with release mk15-0.8b.fc9.i386}}
<!-- {{works with|ELLA ALGOL 68|Any (with appropriate job cards) - tested with release 1.8.8d.fc9.i386}}
Compiles, but I couldn't maxint not in library, works with manually entered maxint, bits width. Leaving some issue with newline -->
<lang algol>PROC is prime = (INT number)BOOL:BEGIN▼
▲PROC is prime = (INT number)BOOL:BEGIN
SKIP # code omitted - see Primality by Trial Division #
END;
MODE POWMODSTRUCT = INT;
PR READ "prelude/pow_mod.a68" PR;
PROC m factor = (INT p)INT:BEGIN
Line 46 ⟶ 48:
SKIP
ELSE
n :=
IF n = 1 THEN
m factor := q;
Line 81 ⟶ 76:
FI
END</lang>
Example:
<pre>
|