OFFSET
0,3
EXAMPLE
There are A001349(3)=2 connected graphs for n=3 unlabeled elements:
The chain
o-o-o
and the triangle
. o
/..\
o - o.
There are a(3)=8 hierarchical orders on these two graphs.
The chain gives us 6 orderings:
o-o-o
o
|
o-o
. o
/..\
o . o
o . o
.\./
. o
o-o
|
o
o
|
o
|
o
The triangle gives us two orderings:
. o
/..\
o - o
o - o
\../
. o
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 A136722(n):
if n == 0: return 1
@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<<n-1 # Chai Wah Wu, Jul 03 2024
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Thomas Wieder, Jan 19 2008
EXTENSIONS
More terms from Alois P. Heinz, Apr 21 2012
STATUS
approved