I'm the maintainer of gmpy2. The caching that is controlled by set_cache() and get_cache() decreases the time it takes to create a new mpz instance. The improvement is only measurable for moderate sized integers. Once you start working with very large numbers, the running time of the computation is so...

Disclaimer: I am the maintainer of gmpy and gmpy2. The Python long type is arbitrary precision. Conversion to/from long and mpz are always exact. Since long is arbitrary precision, the built-in pow() function will calculate the correct result without requiring the use of gmpy or gmpy2. However, using the mpz...

After downloading the GMPY wheel file from Christoph Gohlke's site, you need to open a command window and change to the folder where you downloaded GMPY, and use pip to install it: ~\Downloads\> pip install gmpy2‑2.0.5‑cp27‑none‑win_amd64.whl If you don't have pip, use conda to install it first: ~> conda install...

Disclaimer: I maintain gmpy2. I would recommend using gmpy2.is_bpsw_prp instead of gmpy2.next_prime. The BPSW test will be faster and there are no known counter-examples. The is_prime and next_prime checks used to use, and may still use, a fixed set of bases and it is possible to composites that pass a...

python,python-3.x,sympy,polynomial-math,gmpy

There are a few obstacles: gmpy.mpfr has no ._sympy_ method, so it will be converted to float in an intermediate step. sympy.Poly, by default, uses sympy.polys.domain.RR for floating point coefficients, and will use it to convert. RR, when it loads, uses 53 as its precision, and ignores mpmath.mp.precision. When converting,...

I modified your unpack() and it appears to work for me. If you still get an error, please post the full error. >>> import gmpy2 >>> >>> def unpack(x, b): ... try: ... return [x for x in gmpy2.unpack(gmpy2.mpz(x), b)] ... except NameError: ... b = 2 ** b ......