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
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
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Apr 28 2023
EXTENSIONS
Simpler name by Peter Luschny, Nov 14 2023
STATUS
approved