(fractran= np n fs A Z fi P p N L M . !arg:(?N,?n,?fs) {Number of iterations, start n, fractions} & :?P:?L {Initialise accumulators.} & whl ' ( -1+!N:>0:?N {Stop when counted down to zero.} & !n !L:?L {Prepend all numbers to result list.} & (2\L!n:#?p&!P !p:?P|) {If log2(n) is rational, append it to list of primes.} & !fs:? (/?fi&!n*!fi:~/:?n) ? {This line does the following (See task description): "for the first fraction, fi, in the list for which nfi is an integer, replace n by nfi ;"} ) & :?M & whl'(!L:%?n ?L&!n !M:?M) {Invert list of numbers. (append to long list is very expensive. Better to prepend and finally invert.} & (!M,!P) {Return the two lists} ); ( clk$:?t0 & fractran$(430000, 2, 17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 1/17 11/13 13/11 15/14 15/2 55/1) : (?numbers,?primes) & lst$(numbers,"numbers.lst",NEW) & put$(" FRACTRAN found these primes:" !primes "\nThe list of numbers is saved in numbers.txt The biggest number in the list is" ( 0:?max & !numbers:? (>%@!max:?max&~) ? | !max ) str$("\ntime: " flt$(clk$+-1*!t0,4) " sec\n") , "FRACTRAN.OUT",NEW) );