Changes to support gmpy >=1.13, or gmpy2 >=2.0.0b4

From [issue 3622](http://code.google.com/p/sympy/issues/detail?id=3622). casevh wrote:

I've attached a patch file for the changes I made to support gmpy and gmpy2. (I'm still trying to figure out git....).

With these changes, gmpy 1.13 or later and gmpy2 2.0.0b4 or later should work. I discovered a bug in gmpy2 so I will be releasing b4 in a few days.

Summary of the changes;
sympy.core.compatibility tries importing both gmpy2 and gmpy and checks for the correct version. HAS_GMPY is set to 2 if a valid version of gmpy2 is found. It is set to 1 if a valid version of gmpy is found. And it is set to 0 if no valid version is found.

The check for the requested ground type is also done in sympy.core.compatibility so GROUND_TYPES should be imported from there.

I also added SYMPY_INTS to sympy.core.compatibility. It is a tuple that contains the valid integer types, taking into account the Python version and the requested ground type.

I made the following changes to account for the changes in gmpy2. They are backwards compatible to gmpy 1.13.
- changed mpq.numer() to mpq.numerator
- changed mpq.denom() to mpq.denominator
- changed the uses of qdiv() to use gmpy.qdiv(a,b) instead of a.qdiv(b)
- changed various type checks to use SYMPY_INTS