Reverse key in prod map

This makes things match with other aspects of the debugging output
we’re using.
Output factoring (string form)

This should always be printed as long as we’re debugging/verbose output.
Formatting (spaces)

Just got rid of some unnecessary spaces (formatting)
Leaf detection can now have long terms

As long as each factor appears in only one term, we cannot factor—so
stop at that point.

Since this required using the factor => terms hash at another spot, I
made that its own method and then just replaced the call to common
factor to use that.
Variable renaming

This is more fitting.
Small rewrite for elegance

Changed factor to be a bit shorter, but hopefully no less easy to read.