Highly Cototient Number

Author

Eric W. Weisstein
April 30, 2014

This notebook downloaded from http://mathworld.wolfram.com/notebooks/IntegerSequences/HighlyCototientNumber.nb.

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

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

Code

From https://oeis.org/A100827; can probably be improved

HighlyCototientNumbers[searchMax_:4000]:=Module[
{
m,n,
coPhiAnsYldList=Table[0,{searchMax}],
coPhiAns,
highlyCototientList,
currHigh
},
Do[coPhiAns=m-EulerPhi[m];If[coPhiAns≤searchMax,coPhiAnsYldList[[coPhiAns]]++],{m,searchMax^2}];highlyCototientList={2};currHigh=2;Do[If[coPhiAnsYldList[[n]]>coPhiAnsYldList[[currHigh]],highlyCototientList={highlyCototientList,n};currHigh=n],{n,2,searchMax}];Flatten[highlyCototientList]
]

Compute

Reduce[x-EulerPhi[x]==8,x,Integers]

HighlyCototientNumbers[1000]//Timing