login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A237501 Number of binary strings of length 2n which contain the reversals of each of their two halves. 3

%I #19 Jul 24 2024 08:15:23

%S 4,12,42,106,300,654,1664,3300,7940,15018,34948,64396,147130,267404,

%T 604722,1090998,2453492,4409000,9886266,17729222,39693612,71108358,

%U 159076784,284820632,636918540,1140064414,2548902598,4561828606,10198077780,18250461694,40797250536,73008145904,163198882506,292045189424,652815291522

%N Number of binary strings of length 2n which contain the reversals of each of their two halves.

%H Max Alekseyev, <a href="/A237501/b237501.txt">Table of n, a(n) for n = 1..45</a>

%H Michael S. Branicky, <a href="/A237501/a237501.py.txt">Python program</a>

%e The two halves of 01111011 are 0111 and 1011. Their reversals are 1110 and 1101, and both are substrings of 01111011. Since there are 105 other strings of length 2*4 with this property, a(4) = 106.

%t sQ[L_, {s__}] := MatchQ[L, {___, s, ___}]; a[n_] := Length@ Select[ Tuples[{0, 1}, 2*n], sQ[#, Reverse[Take[#, n]]] && sQ[#, Reverse[Take[#, -n ]]] &]; Array[a,8]

%o (Python) # see link for faster version

%o from itertools import product as prod

%o def ok(s): return s[:len(s)//2][::-1] in s and s[len(s)//2:][::-1] in s

%o def a(n): return 2*sum(ok("0"+"".join(p)) for p in prod("01", repeat=2*n-1))

%o print([a(n) for n in range(1, 12)]) # _Michael S. Branicky_, Feb 06 2021

%Y Cf. A237500, A237502, A241208, A241210, A241211.

%K nonn

%O 1,1

%A _Giovanni Resta_, Feb 08 2014

%E a(17)-a(20) from _Michael S. Branicky_, Feb 06 2021

%E Terms a(21) onward from _Max Alekseyev_, Jul 24 2024

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 26 02:15 EDT 2024. Contains 375454 sequences. (Running on oeis4.)