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.

A344429 a(n) = Sum_{k=1..n} mu(k) * k^n.

Original entry on oeis.org

1, -3, -34, -96, -3399, 30239, -624046, -4482626, -32249230, 9768165230, -186975207617, -2150337557747, -327482869358214, 6894274639051756, 539094536846680025, 8044964790023844733, -707278869236116107432, -12275330572755863672628, -2190860499375418948848067
Offset: 1

Views

Author

Seiichi Manyama, May 19 2021

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := Sum[MoebiusMu[k] * k^n, {k,1,n}]; Array[a, 20] (* Amiram Eldar, May 19 2021 *)
  • PARI
    a(n) = sum(k=1, n, moebius(k)*k^n);
    
  • Python
    from functools import lru_cache
    from math import comb
    from sympy import bernoulli
    @lru_cache(maxsize=None)
    def faulhaber(n,p):
        """ Faulhaber's formula for calculating Sum_{k=1..n} k^p
            requires sympy version 1.12+ where bernoulli(1) = 1/2
        """
        return sum(comb(p+1,k)*bernoulli(k)*n**(p-k+1) for k in range(p+1))//(p+1)
    @lru_cache(maxsize=None)
    def A344429(n,m=None):
        if n <= 1:
            return 1
        if m is None:
            m=n
        c, j = 1, 2
        k1 = n//j
        while k1 > 1:
            j2 = n//k1 + 1
            c += (faulhaber(j-1,m)-faulhaber(j2-1,m))*A344429(k1,m)
            j, k1 = j2, n//j2
        return c+faulhaber(j-1,m)-faulhaber(n,m) # Chai Wah Wu, Nov 02 2023