OFFSET
1,9
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..65537
FORMULA
a(n) = n*floor[(floor(n/2)+sigma(n))/n] - sigma(n).
EXAMPLE
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.
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.
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.
MATHEMATICA
Table[n*Floor[(Floor[n/2]+DivisorSigma[1, n])/n]- DivisorSigma[1, n], {n, 1, 100}]
PROG
(PARI) a(n)=my(s=sigma(n)); s\/n*n-s \\ Charles R Greathouse IV, Feb 15 2013
(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
CROSSREFS
KEYWORD
sign,look
AUTHOR
Labos Elemer, Apr 22 2003
EXTENSIONS
Definition clarified and the example section edited by Antti Karttunen, Sep 25 2018
STATUS
approved