# 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, $\text{lpf}(n)$. For example, $\text{lpf}(91)=7$. For a prime number $p$, clearly $\text{lpf}(p)=p$, while for any composite number^{} (except squares of primes) $$. (The function would be quite useless if 1 is considered a prime, therefore $\text{lpf}(1)$ is undefined — though we could make an argument for $\text{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).

Title | least prime factor |
---|---|

Canonical name | LeastPrimeFactor |

Date of creation | 2013-03-22 17:40:03 |

Last modified on | 2013-03-22 17:40:03 |

Owner | PrimeFan (13766) |

Last modified by | PrimeFan (13766) |

Numerical id | 5 |

Author | PrimeFan (13766) |

Entry type | Definition |

Classification | msc 11A51 |