OFFSET
1,5
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..50
V. A. Liskovets, Some easily derivable sequences, J. Integer Sequences, 3 (2000), #00.2.2.
MATHEMATICA
nn = 15; Clear[g, c, a, b]; c[z_] := Sum[a[n] z^n, {n, 1, nn}];
g[z_] := Sum[NumberOfGraphs[n] z^n, {n, 0, nn}]; sol =
SolveAlways[ 0 == Series[g[z] - Product[1/(1 - z^i)^a[i], {i, 1, nn}], {z, 0, nn}], z]; 2*(Flatten[Table[a[n], {n, 1, nn}] /. sol]) - (Drop[
CoefficientList[Series[g[z], {z, 0, nn + 1}], z], 1]) (* Geoffrey Critzer, Aug 12 2016 *)
PROG
(Python)
from functools import lru_cache
from itertools import combinations
from fractions import Fraction
from math import prod, gcd, factorial
from sympy import mobius, divisors
from sympy.utilities.iterables import partitions
def A054915(n):
@lru_cache(maxsize=None)
def b(n): return int(sum(Fraction(1<<sum(p[r]*p[s]*gcd(r, s) for r, s in combinations(p.keys(), 2))+sum((q>>1)*r+(q*r*(r-1)>>1) for q, r in p.items()), prod(q**r*factorial(r) for q, r in p.items())) for p in partitions(n)))
@lru_cache(maxsize=None)
def c(n): return n*b(n)-sum(c(k)*b(n-k) for k in range(1, n))
return (sum(mobius(n//d)*c(d) for d in divisors(n, generator=True))//n<<1)-b(n) # Chai Wah Wu, Jul 03 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, May 23 2000
EXTENSIONS
More terms from Vladeta Jovovic, Jul 17 2000
STATUS
approved