login
Maximal number of palindromes in a circular binary word of length n.
1

%I #29 Nov 15 2015 13:31:37

%S 1,2,4,6,7,9,10,12,13,15,16,18,19,21,23,24,26,28,29,31,33,34,36,38,39,

%T 41,43,44,46,48

%N Maximal number of palindromes in a circular binary word of length n.

%C The word is to be imagined as written around a circle. We only count palindromes of length m with 1 <= m <= n.

%H David Consiglio, Jr., <a href="/A247000/a247000.py.txt">Alternate Python Program</a>

%H Jamie Simpson, <a href="http://dx.doi.org/10.1016/j.tcs.2014.07.012">Palindromes in circular words</a>, Theoretical Computer Science, Volume 550, 18 September 2014, Pages 66-78; DOI: 10.1016/j.tcs.2014.07.012.

%F Conjectures from _Colin Barker_, Nov 14 2015: (Start)

%F a(n) = a(n-1)+a(n-3)-a(n-4) for n>4.

%F G.f.: x*(x^13-x^12+x^11-x^10+x^9-x^8+x^7-x^6+x^3+2*x^2+x+1) / ((x-1)^2*(x^2+x+1)).

%F (End)

%e n a(n) Example of a word with a(n) palindromes

%e 1 1 (a)

%e 2 2 (aa)

%e 3 4 (aab)

%e 4 6 (aabb) Palindromes are a,b,aa,bb,abba,baab

%e 5 7 (aaaab)

%e 6 9 (aaaabb)

%e 7 10 (aaaaaab)

%e 8 12 (aaaaaabb)

%e 9 13 (aaaaaaaab)

%e 10 15 (aaaaaaaabb)

%e 11 16 (aaaaaaaaaab)

%e 12 18 (aaaaaaaaaabb)

%e 13 19 (aaaaaaaaaaaab)

%e 14 21 (aaaaaaaaaaaabb)

%e 15 23 (aaaaabaaaabaaab)

%e 16 24 (aaaaaaaaaaaaaabb)

%e 17 26 (aaaaaabaaaaabaaab)

%e 18 28 (aaaaaabaaaaabaaaab)

%e 19 29 (aaaaaaabaaaaaabaaab)

%e 20 31 (aaaaaaabaaaaaabaaaab)

%e 21 33 (aaaaaaabaaaaaabaaaaab)

%e 22 34 (aaaaaaaabaaaaaaabaaaab)

%e 23 36 (aaaaaaaabaaaaaaabaaaaab)

%e 24 38 (aaaaaaaabaaaaaaabaaaaaab)

%e 25 39 (aaaaaaaaabaaaaaaaabaaaaab)

%e 26 41 (aaaaaaaaabaaaaaaaabaaaaaab)

%e 27 43 (aaaaaaaaabaaaaaaaabaaaaaaab)

%e 28 44 (aaaaaaaaaabaaaaaaaaabaaaaaab)

%e 29 46 (aaaaaaaaaabaaaaaaaaabaaaaaaab)

%e 30 48 (aaaaaaaaaabaaaaaaaaabaaaaaaaab)

%o (Python)

%o def A247000(n):

%o ....maxcount = 0

%o ....for i in range(2**(n-1),2**n):

%o ........s = format(i,'0'+str(n)+'b')

%o ........s, plist = s+s[:-1], []

%o ........for j in range(n):

%o ............for k in range(n):

%o ................t = s[j:j+k+1]

%o ................if t == t[::-1] and not t in plist:

%o ....................plist.append(t)

%o ........if len(plist) > maxcount:

%o ............maxcount = len(plist)

%o ....return maxcount # _Chai Wah Wu_, Sep 16 2014

%K nonn,more

%O 1,2

%A _N. J. A. Sloane_, Sep 15 2014

%E More terms from _David Consiglio, Jr._, Sep 16 2014