Mod handles more simplification

While still trying to keep evaluation fast, Mod will now
removing a gcd from the terms and check for known differences
between arguments. Denesting is also implemented (although
probably more could be done).

Thanks to Patrick Lacasse for this suggestion to check ratios.
watch for TypeError from int
fix transform tests
don't let sum processing introduce new Mod
Merge pull request #1997 from smichr/mod

Mod handles more simplification