This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A302172 #18 Apr 29 2018 15:00:08 %S A302172 0,0,0,1,2,0,2,1,1,2,2,0,2,0,0,1,2,3,2,2,4,4,2,4,9,6,4,4,2,0,2,1,8,6, %T A302172 0,5,2,6,8,6,2,0,2,4,6,6,2,4,15,7,8,2,2,6,8,0,8,6,2,8,2,6,4,1,12,4,2, %U A302172 2,8,0,2,3,2,6,4,4,24,0,2,6,13,6,2,8,20,6,8,20,2,6,32,8,8,6,24,4,2,3,24,17 %N A302172 Distance from sigma(n) to nearest multiple of phi(n). %C A302172 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, ... %C A302172 Numbers n such that a(n) = 1 are 4, 8, 9, 16, 32, 64, 128, 256, 400, 512, 1024, 2048, 4096, 8192, 16384, ... %H A302172 Harvey P. Dale, <a href="/A302172/b302172.txt">Table of n, a(n) for n = 1..1000</a> %F A302172 a(A020492(n)) = 0. %F A302172 a(2^k) = 1 for k > 1. %F A302172 a(p) = 2 for prime p > 3. %e A302172 a(21) = 4 because sigma(21) = 32 and phi(21) = 12; 12*3 - 32 = 4 is the smallest corresponding distance. %t A302172 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 *) %o A302172 (PARI) a(n) = {my(k=0, s=sigma(n), p=eulerphi(n)); while((s+k) % p != 0 && (s-k) % p != 0, k++); k;} %Y A302172 Cf. A020492, A051612, A063514. %K A302172 nonn,easy %O A302172 1,5 %A A302172 _Altug Alkan_, Apr 03 2018