FACTOR Factor integers into prime components. ----begin documentation---- Program: FACTOR Author: John P. Powers (jpp@cpdvax.csc.ti.com) Date: July 13, 1992 This program produces a list of the prime factors of a given integer. The list is displayed in the form of factor/power pairs. Execute FACTOR to begin the program. A prompt for the integer to factor then appears: N=? Enter an integer. The integer's factors are then displayed. For example, to factor 1584: FACTOR N=?1584 {(2,4) (3,2) (11,1)} The factors of 1584 are 2^4 * 3^2 * 11. ----end documentation---- ----begin ascii---- \START\ \COMMENT=Program file dated 07/13/92, 09:24 \NAME=FACTOR \FILE=factor.85P RectC 0\->\dimL FACTORS Prompt N 1\->\S 2\->\F 0\->\E \sqrt\N\->\M While F\<=\M While mod(N,F)==0 E+1\->\E N/F\->\N End If E>0:Then (F,E)\->\FACTORS(S) 0\->\E S+1\->\S \sqrt\N\->\M End If F==2 Then:3\->\F Else:F+2\->\F End End If N\<>\1:(N,1)\->\FACTORS(S) FACTORS \STOP\ ----end ascii---- ----begin uue---- begin 644 factor.85p M*BI423@U*BH:#`!0