Function Repository Resource:

# LargestPrimeFactor

Find the largest prime factor of a given integer

Contributed by: Wolfram|Alpha Math Team
 ResourceFunction["LargestPrimeFactor"][x] finds the largest prime factor of an integer x.

## Details and Options

ResourceFunction["LargestPrimeFactor"][0] returns 0. ResourceFunction["LargestPrimeFactor"][1] returns 1.
ResourceFunction["LargestPrimeFactor"] ignores the sign of the input; for negative x, ResourceFunction["LargestPrimeFactor"][x] is defined as equal to ResourceFunction["LargestPrimeFactor"][Abs[x]].

## Examples

### Basic Examples (2)

Find the largest prime factor of a number:

 In[1]:=
 Out[1]=

For non-numeric input, LargestPrimeFactor remains unevaluated:

 In[2]:=
 Out[2]=

### Scope (2)

LargestPrimeFactor accepts any integer, including negatives and zero:

 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=

Non-integer numeric input triggers a message:

 In[5]:=

## Publisher

Wolfram|Alpha Math Team

## Version History

• 2.0.0 – 06 September 2019
• 1.0.0 – 16 January 2019