Sunday, December 28, 2008

Comp: Factoring integers in Matlab and Mathematica

Problem: Obtain factors for a very large integer, such as (2^227-1)

Answers (from Mma):
  • 26986333437777017
  • 7992177738205979626491506950867720953545660121688631

Mathematica V7 computes the exact factors in about 11 seconds (Mma V5 was 550 seconds) on my hardware. It has always amazed me that Mma can compute this at all.

Matlab R2007A cannot perform this factorization at all. The Matlab help command explains that TMW has decided to disable [i.e. integer factorization] for numbers greater than 2^32! The Matlab doc entry does not list this restriction at all.


Roger Williams
Franklin Laboratory
This post was originally posted on 7/15/2007 at:

No comments:

Post a Comment