Performs factorization on just about any number.
Appears on
One of a series of library tapes. Programs on these tapes were renamed to a number series. This tape contained programs 20001 to 20050. These tapes were compiled by Tony Willing.
Gallery
Source Code
1 REM "FACTORISE" 2 REM By W.E. Thomson 3 REM ZX Computing Monthly 20 DATA 2,1,2,2,4 30 DATA 2,4,2,4,6,2,6,4,2,4,6,6,2,6,4,2,6,4,6,8,4,2,4,2,4,8,6,4,6,2,4,6,2,6,6,4,2,4,6,2,6,4,2,6,4,10,2,10 40 RESTORE 20 50 INPUT "INPUT A NUMBER <=4294967296: ";N 60 GO SUB 300 70 LET F=0: LET D=0 80 FOR B=0 TO 52: READ Z: LET D=D+Z 100 LET Q=N/D: IF Q<D THEN GO TO 200 110 IF Q=INT Q THEN PRINT "=" AND NOT F;D;"*";: LET F=1: LET N=Q: GO TO 100 120 NEXT B 130 RESTORE 30: LET B=4: NEXT B 200 IF NOT F THEN PRINT " IS PRIME"; 210 IF F THEN GO SUB 300 220 PRINT : GO TO 40 300 LET H=INT (N/1e5) 310 IF NOT H THEN PRINT N;: RETURN 320 PRINT H;(STR$ (N-1e5*(H-1)))(2 TO );: RETURN