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.

This page as a plain text file.
%I A344429 #24 Nov 04 2023 06:40:55
%S A344429 1,-3,-34,-96,-3399,30239,-624046,-4482626,-32249230,9768165230,
%T A344429 -186975207617,-2150337557747,-327482869358214,6894274639051756,
%U A344429 539094536846680025,8044964790023844733,-707278869236116107432,-12275330572755863672628,-2190860499375418948848067
%N A344429 a(n) = Sum_{k=1..n} mu(k) * k^n.
%H A344429 Seiichi Manyama, <a href="/A344429/b344429.txt">Table of n, a(n) for n = 1..386</a>
%t A344429 a[n_] := Sum[MoebiusMu[k] * k^n, {k,1,n}]; Array[a, 20] (* _Amiram Eldar_, May 19 2021 *)
%o A344429 (PARI) a(n) = sum(k=1, n, moebius(k)*k^n);
%o A344429 (Python)
%o A344429 from functools import lru_cache
%o A344429 from math import comb
%o A344429 from sympy import bernoulli
%o A344429 @lru_cache(maxsize=None)
%o A344429 def faulhaber(n,p):
%o A344429     """ Faulhaber's formula for calculating Sum_{k=1..n} k^p
%o A344429         requires sympy version 1.12+ where bernoulli(1) = 1/2
%o A344429     """
%o A344429     return sum(comb(p+1,k)*bernoulli(k)*n**(p-k+1) for k in range(p+1))//(p+1)
%o A344429 @lru_cache(maxsize=None)
%o A344429 def A344429(n,m=None):
%o A344429     if n <= 1:
%o A344429         return 1
%o A344429     if m is None:
%o A344429         m=n
%o A344429     c, j = 1, 2
%o A344429     k1 = n//j
%o A344429     while k1 > 1:
%o A344429         j2 = n//k1 + 1
%o A344429         c += (faulhaber(j-1,m)-faulhaber(j2-1,m))*A344429(k1,m)
%o A344429         j, k1 = j2, n//j2
%o A344429     return c+faulhaber(j-1,m)-faulhaber(n,m) # _Chai Wah Wu_, Nov 02 2023
%Y A344429 Cf. A002321, A008683, A031971, A068340, A321222, A332468, A336276, A336277, A336278, A336279, A344430.
%K A344429 sign
%O A344429 1,2
%A A344429 _Seiichi Manyama_, May 19 2021