-- -- based on Kilburn's Highest Factor Routine -- https://www.computerhistory.org/revolution/birth-of-the-computer/4/87/360 -- 01: LDN 24 -- \ 02: SUB 22 -- | initialization: 03: STO 27 -- | $27 - initial subtraction step (a - 1) 04: LDN 27 -- | $26 - supplementary value -$27 05: STO 26 -- / 06: LDN 24 -- \ 07: SUB 27 -- | subtraction loop 08: CMP -- | subtract $27 from `a` until negative 09: JRP 21 -- / 10: SUB 26 -- \ 11: STO 25 -- | compare negative rest with -$27 12: LDN 25 -- | stop if equal, then $27 is the answer 13: CMP -- / 14: STOP -- stops when C=0, $27 (or $26) is the result 15: LDN 26 -- \ 16: SUB 22 -- \ 17: STO 27 -- | decrement $27 18: LDN 27 -- | jump to division by subtraction 19: STO 26 -- / 20: JMP 23 -- / 21: NUM -3 -- subtraction loop iteration jump 22: NUM 1 -- probe value decrement 23: NUM 5 -- subtraction loop absolute line number (preceeding one) 24: NUM -262144 -- -a ; a=2^18 -- value to factor in negated form -- $25 register to negate result after subtraction loop to compare with iteration step -- $26 supplementary value -$27 -- $27 iteration step