Greatest Prime Factor

Author

Eric W. Weisstein
May 15, 2003

This notebook downloaded from http://mathworld.wolfram.com/notebooks/PrimeNumbers/GreatestPrimeFactor.nb.

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

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

Code

GreatestPrimeFactor[1]:=1
GreatestPrimeFactor[n_Integer?Positive]:=FactorInteger[n][[-1,1]]

Table

Array[GreatestPrimeFactor,20]

Plot

<<Plot`

Show[{
Plot[Sqrt[n],{n,1,100},PlotStyle->Blue,DisplayFunction->Identity],
IntegerListPlot[Array[GreatestPrimeFactor,100],
DisplayFunction->Identity]
},DisplayFunction->$DisplayFunction,
AxesLabel->TraditionalForm/@{n,gpf[n]}]

(Sqrt[n])-Rough

Position[Table[GreatestPrimeFactor[n]>Sqrt[n],{n,100}],True]//Flatten

MakeBoxes[yaxis,TraditionalForm]:=RowBox[{FractionBox["1","n"],RowBox[{UnderoverscriptBox["∑",RowBox[{"k","=","1"}],"n"],RowBox[{"[",RowBox[{RowBox[{"gpf","(","k",")"}],">",SqrtBox["k"]}],"]"}]}]}]

With[{max=10000},
ListPlot[
MapIndexed[#1/Sequence@@#2&,FoldList[Plus,0,Table[If[GreatestPrimeFactor[n]>Sqrt[n],1.,0],{n,2,max}]]],
Epilog->{Blue,Dashing[{.02}],Line[{{0,#},{max,#}}]&[Log[2]]},
PlotRange->{Automatic,{.69,.74}},
PlotJoined->True,PlotStyle->Red,
AxesLabel->TraditionalForm/@{n,yaxis}]
]

Log[2.]

(Sqrt[n])-Smooth

Position[Table[GreatestPrimeFactor[n]<=Sqrt[n],{n,100}],True]//Flatten