![]() ![]() ![]() Unfortunately, the installation failed on my computer. It should offer the convenience of working in Python with the efficiency of PARI. There is a Python interface to PARI called cypari2. So in this example, PARI/GP is about 4 times faster where as for semiprimes it was 10 times faster. The same code in Mathematica took 994.5 seconds. ![]() To compare the efficiency of PARI/GP and Mathematica on non-semiprimes, I repeated the exercise in the previous post, flipping each bit of N one at a time and factoring. It could be that the PARI/GP algorithms are relatively better at factoring semiprimes. So in these examples, Mathematica is several orders of magnitude faster than SymPy, and PARI/GP is one order of magnitude faster than Mathematica. ![]() I then generated a sample of 10 products of 100-bit primes and on average they took 10.4 seconds to factor using PARI/GP. Using PARI/GP, factoring the value of N above took 11.4 seconds to factor. A random sample of 13 products of 100-bit primes and they took an average of 99.1 seconds to factor. Took 99.94 seconds to factor using Mathematica. The previous post factors 200-bit semiprimes. Mathematica factored the same integer in 1/3 of a second. I tried factoring a 140-bit integer with SymPy, and killed the process after over an hour. When it comes to factoring large integers, it’s for worse. SymPy is written in pure Python, for better and for worse. I’ll often use SymPy for a task that Mathematica could do better just so I can stay in one environment. When I’m working in Python, SymPy lets me stay in Python. I started writing that post using Python with SymPy, but moved to Mathematica because factoring took too long. the product of two primes) creates an integer that can be factored much faster. In my previous post, I showed how changing one bit of a semiprime (i.e. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |