OFFSET
1,3
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
PROG
(Python)
from functools import lru_cache
from itertools import product, combinations
from fractions import Fraction
from math import prod, gcd, factorial
from sympy import mobius, divisors
from sympy.utilities.iterables import partitions
def A054918(n):
@lru_cache(maxsize=None)
def b(n): return int(sum(Fraction(1<<sum(p[r]*p[s]*gcd(r, s)<<1 for r, s in combinations(p.keys(), 2))+sum(r*(q*r-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 05 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, May 24 2000
EXTENSIONS
More terms from Vladeta Jovovic, Jul 19 2000
STATUS
approved