Primitive Prime Factor

Author

Eric W. Weisstein
October 11, 2003

This notebook downloaded from http://mathworld.wolfram.com/notebooks/NumberTheory/PrimitivePrimeFactor.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/PrimitivePrimeFactor.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Definition

UnsortedUnion[x_]:=Module[{f},f[y_]:=(f[y]=Sequence[];y);f/@x]

PrimitivePrimeFactorList[l_]:=Module[
{p=First/@FactorInteger[#]&/@l},
Complement@@@Transpose[{p,Most[FoldList[Union,{},p]]}]
]

PrimitivePrimeFactors[l_]:=UnsortedUnion[Flatten[First/@FactorInteger[#]&/@l]]

Example

l=#^2+1&/@Range[10]

FactorInteger/@l

p=(First/@FactorInteger[#])&/@l

PrimitivePrimeFactorList[l]

PrimitivePrimeFactors[l]