login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A185333
Number of binary necklaces of n beads for which a cut exists producing a palindrome.
3
2, 2, 4, 3, 8, 6, 16, 9, 32, 20, 64, 34, 128, 72, 256, 129, 512, 272, 1024, 516, 2048, 1056, 4096, 2050, 8192, 4160, 16384, 8200, 32768, 16512, 65536, 32769, 131072, 65792, 262144, 131088, 524288, 262656, 1048576, 524292, 2097152
OFFSET
1,1
COMMENTS
For odd n, this corresponds to A029744, necklaces of n beads that are the same when turned over. For even n, consider the necklace "01", which satisfies A029744 but cannot be cut to produce a palindrome.
LINKS
Hugo Pfoertner and Robert G. Wilson v, Table of n, a(n) for n = 1..1000
MATHEMATICA
f[n_] := If[OddQ@ n, 2^(n/2 + 1/2), Block[{k = IntegerExponent[n, 2] - 1}, 2^(n/2 - 1) + 2^((n/2 - 2^k)/(2^(k + 1)))]]; Array[f, 41] (* Robert G. Wilson v, Aug 08 2011 *)
PROG
(Python)
def a(n):
if n%2: return 2**((n + 1)//2)
k=bin(n - 1)[2:].count('1') - bin(n)[2:].count('1')
return 2**(n//2 - 1) + 2**((n//2 - 2**k)//(2**(k + 1)))
print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 29 2017
CROSSREFS
Cf. A185376, A025480. - Hugo Pfoertner, Jul 30 2011
Sequence in context: A133806 A360241 A283717 * A005176 A050335 A360686
KEYWORD
nonn
AUTHOR
Tony Bartoletti, Feb 20 2011
STATUS
approved