Article 6Z3JZ Time to factor big integers Python and Mathematica

Time to factor big integers Python and Mathematica

by
John
from John D. Cook on (#6Z3JZ)

This post will look at the time required to factor n - 1 each of the following prime numbers in Python (SymPy) and Mathematica. The next post will explain why I wanted to factor these numbers.

p = 2254 + 4707489544292117082687961190295928833
q = 2254 + 4707489545178046908921067385359695873
r = 2254 + 45560315531419706090280762371685220353
s = 2254 + 45560315531506369815346746415080538113

Here are the timing results.

 | | Python | Mathematica | |---+----------+-------------| | p | 0.913 | 0.616 | | q | 0.003 | 0.002 | | r | 582.107 | 14.915 | | s | 1065.925 | 20.763 |

This is hardly a carefully designed benchmark, but it's enough to suggest Mathematica can be a couple orders of magnitude faster than Python.

Here are the factorizations.

p - 1 = 234 * 3 * 4322432633228119 * 129942003317277863333406104563609448670518081918257
q - 1 = 233 * 3 * 5179 * 216901160674121772178243990852639108850176422522235334586122689
r - 1 = 232 * 32 * 463 * 539204044132271846773 * 8999194758858563409123804352480028797519453
s - 1 = 232 * 32 * 1709 * 24859 * 1690502597179744445941507 * 10427374428728808478656897599072717

The post Time to factor big integers Python and Mathematica first appeared on John D. Cook.
External Content
Source RSS or Atom Feed
Feed Location http://feeds.feedburner.com/TheEndeavour?format=xml
Feed Title John D. Cook
Feed Link https://www.johndcook.com/blog
Reply 0 comments