cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A367327 a(n) = Sum_{(n - k) does not divide n, 0 <= k < n} k^2.

Original entry on oeis.org

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

Views

Author

Peter Luschny, Nov 14 2023

Keywords

Crossrefs

Programs

  • 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}]
  • PARI
    a(n) = sum(k=0, n-1, if (n % (n-k), k^2)); \\ Michel Marcus, Nov 15 2023
  • 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
    
  • 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)])
    

Formula

A367326(n+1) + a(n+1) = A000330(n).