OFFSET
1,5
COMMENTS
Numbers n such that a(n) <> A063514(n) are 8, 16, 21, 22, 25, 28, 32, 36, 40, 48, 50, 54, 55, 63, 64, 65, 68, 76, 77, 80, ...
Numbers n such that a(n) = 1 are 4, 8, 9, 16, 32, 64, 128, 256, 400, 512, 1024, 2048, 4096, 8192, 16384, ...
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
FORMULA
EXAMPLE
a(21) = 4 because sigma(21) = 32 and phi(21) = 12; 12*3 - 32 = 4 is the smallest corresponding distance.
MATHEMATICA
dsp[n_]:=Module[{s=DivisorSigma[1, n], p=EulerPhi[n], m}, m=Floor[s/p]; Abs[ Nearest[ {m*p, (m+1)p}, s]-s]]; Array[dsp, 100][[All, 1]] (* Harvey P. Dale, Apr 29 2018 *)
PROG
(PARI) a(n) = {my(k=0, s=sigma(n), p=eulerphi(n)); while((s+k) % p != 0 && (s-k) % p != 0, k++); k; }
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Altug Alkan, Apr 03 2018
STATUS
approved