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!)
A229614 Number of binary strings of length n avoiding "squares" (that is, repeated blocks of the form xx) with |x| > 2. 4

%I #42 Nov 14 2021 03:30:03

%S 1,2,4,8,16,32,56,104,178,314,536,930,1558,2666,4482,7574,12686,21360,

%T 35812,60152,100812,169122,283498,475356,796292,1334558,2235888,

%U 3746534,6276048,10515080,17614726,29510362,49434792,82815016,138729368,232399846,389306052

%N Number of binary strings of length n avoiding "squares" (that is, repeated blocks of the form xx) with |x| > 2.

%C Entringer et al. showed that this sequence is always nonzero (in contrast with A230127, which is zero for all n >= 19). - _Nathaniel Johnston_, Oct 10 2013

%C For n >= 1, terms are even by symmetry. - _Michael S. Branicky_, Nov 11 2021

%H Michael S. Branicky, <a href="/A229614/b229614.txt">Table of n, a(n) for n = 0..42</a>

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

%H R. C. Entringer, D. E. Jackson and J. A. Schatz, <a href="http://dx.doi.org/10.1016/0097-3165(74)90041-7">On nonrepetitive sequences</a>, J. Combin. Theory Ser. A. 16 (1974), 159-164.

%e For n = 6 there are 8 strings omitted, namely 000000, 001001, ..., 111111, so a(6) = 64 - 8 = 56.

%t a[n_] := a[n] = Select[PadLeft[#, n]& /@ IntegerDigits[Range[0, 2^n-1], 2], {} == SequencePosition[#, {b__, b__} /; Length[{b}] >= 3, 1]&] // Length;

%t Table[Print[n, " ", a[n]]; a[n], {n, 0, 22}] (* _Jean-François Alcover_, Nov 11 2021 *)

%o (Python) # see link for a faster program based on binary operations

%o def isf(s): # incrementally squarefree (check factors ending in last letter)

%o for l in range(3, len(s)//2 + 1):

%o if s[-2*l:-l] == s[-l:]: return False

%o return True

%o def aupton(nn, verbose=False):

%o alst, sfs = [1], set("0")

%o for n in range(1, nn+1):

%o an = 2*len(sfs) # by symmetry

%o sfsnew = set(s+i for s in sfs for i in "01" if isf(s+i))

%o alst, sfs = alst+[an], sfsnew

%o if verbose: print(n, an)

%o return alst

%o print(aupton(24)) # _Michael S. Branicky_, Nov 11 2021

%Y Cf. A230127, A230177, A230216.

%K nonn

%O 0,2

%A _Jeffrey Shallit_, Sep 26 2013

%E a(23)-a(36) from _Nathaniel Johnston_, Oct 10 2013

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 April 18 22:18 EDT 2024. Contains 371782 sequences. (Running on oeis4.)