login
a(n) = A082895(n)-A000203(n); the distance from sigma(n) to that multiple of n which is closest to sigma(n), positive terms for cases where the closest multiple is after sigma(n), and negative terms where it is before sigma(n). In case of ties, a positive term is selected.
5

%I #19 Oct 05 2018 11:18:31

%S 0,1,-1,1,-1,0,-1,1,-4,2,-1,-4,-1,4,6,1,-1,-3,-1,-2,10,8,-1,12,-6,10,

%T -13,0,-1,-12,-1,1,-15,14,-13,17,-1,16,-17,-10,-1,-12,-1,4,12,20,-1,

%U 20,-8,7,-21,6,-1,-12,-17,-8,-23,26,-1,12,-1,28,22,1,-19,-12,-1,10,-27,-4,-1,21,-1,34,26,12,-19,-12,-1,-26,-40,38,-1,28

%N a(n) = A082895(n)-A000203(n); the distance from sigma(n) to that multiple of n which is closest to sigma(n), positive terms for cases where the closest multiple is after sigma(n), and negative terms where it is before sigma(n). In case of ties, a positive term is selected.

%H Antti Karttunen, <a href="/A082901/b082901.txt">Table of n, a(n) for n = 1..65537</a>

%F a(n) = n*floor[(floor(n/2)+sigma(n))/n] - sigma(n).

%e n=2: sigma(2)=3, the closest even numbers to 3 are 2 and 4, we choose 4 to get a positive difference, thus a(2) = 4-3 = 1.

%e n=28: sigma(28) = 56, thus a multiple of 28 which is closest to 28 is 28, so the difference is zero. Positions of zeros for this sequence is given by the multiply perfect numbers, A007691.

%e When n is a prime p > 2, sigma(p) = p+1, thus the multiple of p closest to p+1 is p, so difference is -1.

%t Table[n*Floor[(Floor[n/2]+DivisorSigma[1, n])/n]- DivisorSigma[1, n], {n, 1, 100}]

%o (PARI) a(n)=my(s=sigma(n));s\/n*n-s \\ _Charles R Greathouse IV_, Feb 15 2013

%o (PARI) A082901(n) = { my(s=sigma(n), a = ((s\n)*n)-s, b = ((1+(s\n))*n)-s); if(b <= abs(a), b, a); }; \\ _Antti Karttunen_, Oct 01 2018

%Y Cf. A082893-A082900, A000203, A007691.

%K sign,look

%O 1,9

%A _Labos Elemer_, Apr 22 2003

%E Definition clarified and the example section edited by _Antti Karttunen_, Sep 25 2018