1         REM   PRINT TABLE OF PRIMES
1         REM   ADAPTED FROM TOM SAWYER'S 205 PAPER-TAPE LOAD PROGRAM
1         REM   P.KIMPEL, 2017-07-04.
1         LOCN  0900
1         REM
1   LOOP  CAD   FACTR           LOAD CURRENT FACTOR VALUE
1         MUL   FACTR           SQUARE THE FACTOR
1         CFR   CANDT           COMPARE SQUARE TO PRIME CANDIDATE
1         BCH   PROUT           IF SQUARE > CANDIDATE, HAVE A PRIME
1         CAD   CANDT           OTHERWISE, LOAD THE PRIME CANDIDATE
1         SRT   10              SHIFT TO R FOR DIVISION
1         DIV   FACTR           DIVIDE CANDIDATE BY FACTOR
1         BZR   NXTPR           IF REMAINDER=0, HAS A FACTOR, NOT PRIME
1         IFL   FACTR,00,2      OTHERWISE, INCREMENT FACTOR BY 2
1         BUN   LOOP            GO TEST NEW FACTOR AGAINST CURRENT CANDIDATE
1         REM
1   PROUT SPO   CANDT,1         HAVE A PRIME, PRINT IT
1         DFL   LINCT,00,1      DECREMENT THE LINE COUNTER
1         BRP   NXTPR           IF NO UNDERFLOW, SKIP PRINTING A CR
1         SPO   CR,1            AT LINE END, PRINT A CR
1         CAD   LINMX           LOAD LINE COUNTER RESET VALUE
1         STA   LINCT           STORE LINE COUNTER
1   NXTPR IFL   CANDT,00,2      INCREMENT PRIME CANDIDATE VALUE BY 2
1         BOF   STOP            IF OVERFLOW, END PROGRAM
1         CAD   FACTI           LOAD INITIAL FACTOR VALUE
1         STA   FACTR           STORE PRIME FACTOR
1         BUN   LOOP            GO TEST NEW PRIME CANDIDATE
1         REM
1   STOP  HLT   7777            HALT, NUMERIC LIMIT EXCEEDED
1         REM
1   CANDT CNST  3               CURRENT PRIME CANDIDATE VALUE
1   FACTR CNST  3               CURRENT PRIME FACTOR VALUE
1   FACTI CNST  3               PRIME FACTOR RESET VALUE
1   LINCT CNST  5               LINE COUNTER
1   LINMX CNST  5               LINE COUNTER RESET VALUE
1   CR    CNST  20202020216     CARRIAGE RETURN WORD
1         FINI  900
