Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #27 Nov 15 2023 01:59:28
%S 0,0,1,1,6,3,15,11,22,23,45,22,66,59,69,71,120,84,153,112,158,179,231,
%T 144,256,263,283,266,378,267,435,367,444,479,503,397,630,611,641,550,
%U 780,621,861,766,798,923,1035,772,1086,1018,1143,1112,1326,1119,1337,1212,1448
%N a(n) = Sum_{k not divides n - k, 0 <= k < n} k.
%C 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.
%H <a href="/index/Si#SIGMAN">Index entries for sequences related to sigma(n)</a>
%F a(n) = n*(n-1)/2 - n*tau(n) + sigma(n). [Previous name.]
%F a(n) = n*(n - tau(n)) - antisigma(n).
%F a(n) = Sum_{k=1..n} (n - k) * (ceiling(n/k) - floor(n/k)).
%F a(n) = A161680(n) - A094471(n).
%F a(p) = (p-1)*(p-2)/2, for primes p.
%p divides := (k, n) -> k = n or (k > 0 and irem(n, k) = 0):
%p A362625 := n -> local k; add(`if`(divides(n - k, n), 0, k), k = 0..n - 1):
%p seq(A362625(n), n = 1..57); # _Peter Luschny_, Nov 14 2023
%t Table[n (n - 1)/2 - n*DivisorSigma[0, n] + DivisorSigma[1, n], {n, 100}]
%t (* Alternative: *)
%t a[n_] := Sum[If[Divisible[n, n - k], 0, k], {k, 0, n - 1}]
%t Table[a[n], {n, 1, 57}] (* _Peter Luschny_, Nov 14 2023 *)
%o (PARI) a(n) = n*(n-1)/2 - n*numdiv(n) + sigma(n); \\ _Michel Marcus_, Apr 28 2023
%o (Python)
%o from math import prod
%o from sympy import factorint
%o def A362625(n):
%o f = factorint(n)
%o 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
%o (SageMath)
%o def A362625(n): return sum(k for k in (0..n-1) if not (n-k).divides(n))
%o print([A362625(n) for n in srange(1, 58)]) # _Peter Luschny_, Nov 14 2023
%Y Cf. A000005 (tau), A000203 (sigma), A024816 (antisigma), A049820 (n-d(n)), A094471, A161680.
%K nonn,easy
%O 1,5
%A _Wesley Ivan Hurt_, Apr 28 2023
%E Simpler name by _Peter Luschny_, Nov 14 2023