Wolfram ResearchProductsPurchasingServices & ResourcesAbout UsOur Sites
Mathematica Technical FAQs Services & Resources / Mathematica / Kernels & Programming
-----
 /
Symbols
*Mathematica
*Network Mathematica
*webMathematica
*gridMathematica
*Personal Grid Edition
*Wolfram Workbench
*Wolfram Education Group
*Application Packages
*Mathematica for Students
*Mathematica CalcCenter
*Publicon
*A New Kind of Science Explorer
*Mathematical Explorer
*Mathematica Teacher's Edition
*Calculus WIZ
*Mathematica Player
*Ask about this page
*Print this page
*Email this page
*Give us feedback
*
Sign up for our newsletter:

FactorInteger


Usage Message:

FactorInteger[n] gives a list of the prime factors of the integer n, together with their exponents.

Attributes[FactorInteger] = {Listable, Protected}

Options:

FactorComplete -> True

GaussianIntegers -> False

Related Symbols

Divisors , DivisorSigma , EulerPhi , Prime , PrimeQ

Notes:

FactorInteger[n] returns a list of pairs {p, k}, where p is a factor of n, and k is the multiplicity of that factor. You can use Apply to reconstruct the original integer from the result of FactorInteger.
In[1]:= result = FactorInteger[-39740679]

Out[1]= {{-1, 1}, {3, 3}, {11, 1}, {17, 2}, {463, 1}}

In[2]:= Times @@ Apply[Power, result, {1}]

Out[2]= -39740679

The algorithm used by FactorInteger uses trial division to remove small primes, and switches between the Pollard p-1, Pollard rho, and continued fraction algorithms for larger factors.

Mathematically, integer factorization is only unique up to units. For example, although FactorInteger[-6] gives {{-1, 1}, {2, 1}, {3, 1}}, the result could in principle also be something like {{-2, 1}, {3, 1}} or {{-3, 1}, {2, 1}}.

For positive integers, the only unit is {1, 1}, which is included in the list of factors only for FactorInteger[1]. (In Mathematica Version 2.2, FactorInteger returns {}.) For negative integers, Mathematica includes the unit {-1, 1} as the first element in the result.

In Mathematica Version 3.0 there is an error in FactorInteger that can cause the kernel to crash if the multiplicity of one of the factors is greater than 2^16. This problem will be corrected for the next version of Mathematica. The solution to this problem is to temporarily create an expression (such as the result of Table[p, {2^16}] that includes at least 2^16 copies of the repeated factor.


Additional Online Documentation:

Mathematica 3.0
http://documents.wolfram.com/v3/RefGuide/FactorInteger.html

Mathematica 4.0
http://documents.wolfram.com/v4/RefGuide/FactorInteger.html




 © 2008 Wolfram Research, Inc.  Terms of Use  Privacy Policy