## You are here

Homeleast prime factor

## Primary tabs

# least prime factor

The least prime factor of a positive integer $n$ is the smallest positive prime number dividing $n$. Sometimes expressed as a function, $\textrm{lpf}(n)$. For example, $\textrm{lpf}(91)=7$. For a prime number $p$, clearly $\textrm{lpf}(p)=p$, while for any composite number (except squares of primes) $(\textrm{lpf}(n))^{2}<n$. (The function would be quite useless if 1 is considered a prime, therefore $\textrm{lpf}(1)$ is undefined — though we could make an argument for $\textrm{lpf}(0)=2$). In the sequence of least prime factors for each integer in turn, each prime occurs first at the index for itself then not again until its square.

In Mathematica, one can use `LeastPrimeFactor[n]`

after loading a number theory package, or much more simply by using the command `FactorInteger[n][[1,1]]`

(of course substituting `n`

as necessary).

## Mathematics Subject Classification

11A51*no label found*

- Forums
- Planetary Bugs
- HS/Secondary
- University/Tertiary
- Graduate/Advanced
- Industry/Practice
- Research Topics
- LaTeX help
- Math Comptetitions
- Math History
- Math Humor
- PlanetMath Comments
- PlanetMath System Updates and News
- PlanetMath help
- PlanetMath.ORG
- Strategic Communications Development
- The Math Pub
- Testing messages (ignore)

- Other useful stuff
- Corrections