PRIMEX.MSE documentation - 7/1/2010 - lrb The leading line is a comment. The global variable Q gets loaded with a number entered by the user. No validity checking is done (in range?, numeric? etc.) One less than the number entered is put in a variable l (the letter el, not to be confused with the number 1). Q is bumped up by 20. The program loops from 25 down to 5 (say 5 was entered), displaying the number, a colon and the factors of the numbers. Enter a number in the range [2,32767] : 5 25 : 5^2 24 : 2^3 3 23 : 23 is prime. 22 : 2 11 21 : 3 7 Strike Any Key ... 20 : 2^2 5 19 : 19 is prime. (output omitted) 9 : 3^2 8 : 2^3 7 : 7 is prime. 6 : 2 3 5 : 5 is prime. The G macro puts the first and second arguments passed to it into local variables n (the number) and f (the factor candidate). In the off chance f is 2 and n is not divisible by 2, f is changed to 3. A loop which involves testing whether n is divisible by f adjusts f by adding 2 to it (possibly 0 times) until n is divisible by f. A local variable c is initialized to 1. Another local, d, is initialized to n/f. Another local, g, is set to what's in f. A loop adjusts d, c and g while d is divisible by f (which it might never be). c ends up holding the exponent for the factor f. The factor (and its exponent if greater than 1) are displayed. There is a pause when the number getting factored is divisible by 10 and the user must strike a key to continue. The loop leaves g with the value f^c and d with the value n/f^c. If this g is less than n, G is called (recursively) with d and f as arguments. The text "is prime." is appended to the display if it's found that f equals the global Q.