Function Repository Resource:

InactiveFactorInteger

Source Notebook

Compute the prime factorization of an integer and return it in an inactivated form

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["InactiveFactorInteger"][n]

returns the prime factorization of n in an inactivated form.

Details and Options

For all positive integers n, ResourceFunction["InactiveFactorInteger"][n] returns an expression with head Inactive[Times].
ResourceFunction["InactiveFactorInteger"] has attribute HoldAll.

Examples

Basic Examples (3) 

Factor an integer:

In[1]:=
res = ResourceFunction["InactiveFactorInteger"][136]
Out[1]=

The head of this result is Inactive[Times]:

In[2]:=
Head[res]
Out[2]=

Applying Activate returns the original integer:

In[3]:=
Activate[res]
Out[3]=

Properties and Relations (2) 

By holding it's input unevaluated, InactiveFactorInteger can factorize certain explicit powers efficiently:

In[4]:=
ResourceFunction["InactiveFactorInteger"][10^123123] // AbsoluteTiming
Out[4]=

Evaluating and then factoring the power, is significantly slower:

In[5]:=
ResourceFunction["InactiveFactorInteger"][
  Evaluate[10^123123]] // AbsoluteTiming
Out[5]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 5.0.0 – 23 March 2023
  • 4.1.0 – 12 May 2021
  • 4.0.0 – 01 May 2020
  • 3.0.0 – 24 January 2020
  • 2.0.0 – 06 September 2019
  • 1.0.0 – 26 August 2019

Related Resources

License Information