OFFSET
1,2
LINKS
FORMULA
a(n) = A087854(2*n,n) = (n!/(2*n)) * Sum_{d|2*n} phi(d) * S2(2*n/d, n) where S2(n,k) are the Stirling numbers of the second kind.
a(n) = (n!/(2*n))*(S2(2*n, n)+1) since S2(n, n) = 1 and S2(2*n/d, n) = 0 if d>2.
EXAMPLE
a(2) = 4, corresponding to the necklaces WBBB, WBWB, WWBB, and WWWB.
MATHEMATICA
Table[n! * (StirlingS2[2*n, n] + 1) / (2*n), {n, 1, 16}] (* Amiram Eldar, Sep 25 2020 *)
PROG
(PARI) T(n, k) = (k!/n) * sumdiv(n, d, eulerphi(d) * stirling(n/d, k, 2)); \\ A087854
vector(22, n, T(2*n, n)) \\ Joerg Arndt, Sep 25 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Yves-Loic Martin, Sep 24 2020
EXTENSIONS
Terms a(6) and beyond from Joerg Arndt, Sep 25 2020
STATUS
approved