Merge pull request #15 from jadmanski/py39-fix

Use math.gcd or fractions.gcd depending on what is available