OFFSET
0,3
PROG
(PARI) T(n, k) = binomial(n, k) - sumdiv(gcd(n+!n, k), d, moebius(d)*binomial(n/d, k/d)); \\ A050870
row(n) = vector(n+1, k, k--; T(n, k));
a(n) = n*=2; vecsum(row(n))/2; \\ Michel Marcus, Aug 20 2021
(Python)
from sympy import mobius, divisors
def A050872(n): return -sum(mobius((n<<1)//d)<<d-1 for d in divisors(n<<1, generator=True) if d<n<<1) # Chai Wah Wu, Sep 21 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
a(29) onward corrected by Sean A. Irvine, Aug 20 2021
STATUS
approved