login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A367327
a(n) = Sum_{(n - k) does not divide n, 0 <= k < n} k^2.
2
0, 0, 0, 1, 1, 14, 5, 55, 39, 104, 115, 285, 104, 506, 457, 575, 611, 1240, 790, 1785, 1204, 1950, 2349, 3311, 1746, 3924, 4155, 4625, 4312, 6930, 4375, 8555, 6939, 9032, 10127, 10845, 7887, 14910, 14549, 15603, 12730, 20540, 15273, 23821, 20648, 21874, 26905
OFFSET
0,6
LINKS
FORMULA
A367326(n+1) + a(n+1) = A000330(n).
MAPLE
divides := (k, n) -> k = n or (k > 0 and irem(n, k) = 0):
A367327 := n -> local k; add(`if`(divides(n - k, n), 0, k^2), k = 0..n - 1):
seq(A367327(n), n = 0..61);
MATHEMATICA
a[n_] := Sum[If[Divisible[n, n - k], 0, k^2], {k, 0, n - 1}]
Table[a[n], {n, 0, 46}]
PROG
(SageMath)
def A367327(n): return sum(k^2 for k in (0..n-1) if not (n-k).divides(n))
print([A367327(n) for n in range(47)])
(Python)
from math import prod
from sympy import factorint
def A367327(n):
f = factorint(n).items()
return n*(n-1)*((n<<1)-1)//6-n*(n*prod(e+1 for p, e in f)-(prod((p**(e+1)-1)//(p-1) for p, e in f)<<1))-prod((p**(e+1<<1)-1)//(p**2-1) for p, e in f) if n else 0 # Chai Wah Wu, Nov 14 2023
(PARI) a(n) = sum(k=0, n-1, if (n % (n-k), k^2)); \\ Michel Marcus, Nov 15 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Nov 14 2023
STATUS
approved