%I M0774 #53 May 02 2020 16:39:46
%S 1,2,3,6,10,20,37,74,143,284,559,1114,2206,4394,8740,17418,34696,
%T 69194,137971,275280,549258,1096286,2188333,4369162,8724154,17422652,
%U 34797199,69505908,138845926,277383872,554189329,1107297290,2212558942
%N Number of self-complementary 2-colored bracelets (turnover necklaces) with 2n beads.
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Vincenzo Librandi, <a href="/A007148/b007148.txt">Table of n, a(n) for n = 1..1000</a>
%H E. M. Palmer and R. W. Robinson, <a href="http://projecteuclid.org/euclid.pjm/1102711113">Enumeration of self-dual configurations</a> Pacific J. Math., 110 (1984), 203-221.
%H F. Ruskey, <a href="http://combos.org/necklace">Necklaces, Lyndon words, De Bruijn sequences, etc.</a>
%H F. Ruskey, <a href="/A000011/a000011.pdf">Necklaces, Lyndon words, De Bruijn sequences, etc.</a> [Cached copy, with permission, pdf format only]
%H <a href="/index/Br#bracelets">Index entries for sequences related to bracelets</a>
%F a(n) = 2^(n-2) + (1/(4n)) * Sum_{d|n} phi(2d)*2^(n/d). - _N. J. A. Sloane_, Sep 25 2012
%F a(n) = (1/2)*(A000079(n-1) + A000013(n)).
%p # see A245558
%p L := proc(n,k)
%p local a,j ;
%p a := 0 ;
%p for j in numtheory[divisors](igcd(n,k)) do
%p a := a+numtheory[mobius](j)*binomial(n/j,k/j) ;
%p end do:
%p a/n ;
%p end proc:
%p A007148 := proc(n)
%p local a,k,l;
%p a := 0 ;
%p for k from 1 to n do
%p for l in numtheory[divisors](igcd(n,k)) do
%p a := a+L(n/l,k/l)*ceil(k/2/l) ;
%p end do:
%p end do:
%p a;
%p end proc:
%p seq(A007148(n),n=1..20) ; # _R. J. Mathar_, Jul 23 2017
%t a[n_] := (1/2)*(2^(n-1) + Total[ EulerPhi[2*#]*2^(n/#) & /@ Divisors[n]]/(2*n)); Table[ a[n], {n, 1, 33}] (* _Jean-François Alcover_, Oct 25 2011 *)
%o (PARI) a(n)= (1/2) *(2^(n-1)+sumdiv(n,k,eulerphi(2*k)*2^(n/k))/(2*n))
%o (Python)
%o from sympy import divisors, totient
%o def a(n):
%o if n==1: return 1
%o return 2**(n - 2) + sum(totient(2*d)*2**(n//d) for d in divisors(n))//(4*n)
%o print([a(n) for n in range(1, 31)]) # _Indranil Ghosh_, Jul 24 2017
%Y Cf. A000013, A000079, A007147.
%Y Different from, but easily confused with, A045690 and A093371.
%K nonn,nice,easy
%O 1,2
%A _N. J. A. Sloane_
%E Description corrected by _Christian G. Bower_