Prime decomposition: Difference between revisions

m
(→‎Version 2: correction about the square root algorithm.)
Line 688:
=={{header|ALGOL-M}}==
Sadly, ALGOL-M does not allow arrays to be passed as parameters to procedures or functions, so the routine
must store its results in (and know the name of!) the external array used for that purpose.
<lang ALGOL>
BEGIN
Line 695:
INTEGER ARRAY FACTORS[1:16];
 
COMMENT COMPUTE- RETURN P MOD Q;
INTEGER FUNCTION MOD (P, Q);
INTEGER P, Q;
Line 734:
WRITE(I,":");
NFOUND := PRIMEFACTORS(I);
COMMENT - PRINT OUT THE FACTORS THAT WERE FOUND;
FOR K := 1 STEP 1 UNTIL NFOUND DO
BEGIN
Line 757 ⟶ 758:
99: 3 3 11
</pre>
 
=={{header|Applesoft BASIC}}==
<lang ApplesoftBasic>9040 PF(0) = 0 : SC = 0
211

edits