login
A362625
a(n) = Sum_{k not divides n - k, 0 <= k < n} k.
1
0, 0, 1, 1, 6, 3, 15, 11, 22, 23, 45, 22, 66, 59, 69, 71, 120, 84, 153, 112, 158, 179, 231, 144, 256, 263, 283, 266, 378, 267, 435, 367, 444, 479, 503, 397, 630, 611, 641, 550, 780, 621, 861, 766, 798, 923, 1035, 772, 1086, 1018, 1143, 1112, 1326, 1119, 1337, 1212, 1448
OFFSET
1,5
COMMENTS
a(n) is the total distance from n to each of its nondivisors. For example, a(6)=3 since the nondivisors of 6 are 4,5 and (6-4)+(6-5) = 2+1 = 3.
FORMULA
a(n) = n*(n-1)/2 - n*tau(n) + sigma(n). [Previous name.]
a(n) = n*(n - tau(n)) - antisigma(n).
a(n) = Sum_{k=1..n} (n - k) * (ceiling(n/k) - floor(n/k)).
a(n) = A161680(n) - A094471(n).
a(p) = (p-1)*(p-2)/2, for primes p.
MAPLE
divides := (k, n) -> k = n or (k > 0 and irem(n, k) = 0):
A362625 := n -> local k; add(`if`(divides(n - k, n), 0, k), k = 0..n - 1):
seq(A362625(n), n = 1..57); # Peter Luschny, Nov 14 2023
MATHEMATICA
Table[n (n - 1)/2 - n*DivisorSigma[0, n] + DivisorSigma[1, n], {n, 100}]
(* Alternative: *)
a[n_] := Sum[If[Divisible[n, n - k], 0, k], {k, 0, n - 1}]
Table[a[n], {n, 1, 57}] (* Peter Luschny, Nov 14 2023 *)
PROG
(PARI) a(n) = n*(n-1)/2 - n*numdiv(n) + sigma(n); \\ Michel Marcus, Apr 28 2023
(Python)
from math import prod
from sympy import factorint
def A362625(n):
f = factorint(n)
return (n*(n-1)>>1)-n*prod(e+1 for e in f.values())+prod((p**(e+1)-1)//(p-1) for p, e in f.items()) # Chai Wah Wu, Apr 28 2023
(SageMath)
def A362625(n): return sum(k for k in (0..n-1) if not (n-k).divides(n))
print([A362625(n) for n in srange(1, 58)]) # Peter Luschny, Nov 14 2023
CROSSREFS
Cf. A000005 (tau), A000203 (sigma), A024816 (antisigma), A049820 (n-d(n)), A094471, A161680.
Sequence in context: A097917 A116570 A335567 * A352015 A225503 A302350
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Apr 28 2023
EXTENSIONS
Simpler name by Peter Luschny, Nov 14 2023
STATUS
approved