login
Stewart's choral sequence: a(3n) = 0, a(3n-1) = 1, a(3n+1) = a(n).
12

%I #39 Dec 23 2021 10:03:37

%S 0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,1,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,

%T 1,1,0,0,1,0,0,1,0,1,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,0,1,0,1,

%U 1,0,1,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,1,1,0,0,1,0,1,1

%N Stewart's choral sequence: a(3n) = 0, a(3n-1) = 1, a(3n+1) = a(n).

%C The sequence is cubefree, i.e., it contains no substrings of the form XXX where X is a sequence of 0's and 1's.

%C The sequence is the same as the infinite binary word w(infty) generated by w(n+1)=w(n)w(n)w*(n), where n is in {0,1,2,...}, w(0)=0 and w*(n) is w(n) with the middle letter changed. (Example: w*(0)=1, w(1)=001, w*(1)=011, w(2)=001001011.) - Joel Reyes Noche (joel.noche(AT)up.edu.ph), Mar 24 2008

%C The sequence is the fixed point of the morphism 0->001, 1->011, starting from a(0) = 0. - Joel Reyes Noche (joel.noche(AT)up.edu.ph), Apr 28 2008

%C A generalized choral sequence c(3n+r_0)=0, c(3n+r_1)=1, c(3n+r_c)=c(n), with r_0=0, r_1=2, and r_c=1. - Joel Reyes Noche (joel.noche(AT)up.edu.ph), Jul 09 2009

%C It is an infinite Lyndon word; it has an infinite number of prefixes which are Lyndon words (0, 001, 001001011, etc.). - Joel Reyes Noche (joel.noche(AT)up.edu.ph), Nov 01 2009

%C This sequence (with offset 1) is given by a(3k-2)=0, a(3k-1)=a(k), a(3k)=1-a(k) for k>=1, a(0)=0; for sequences generated by such recurrences, see A189628. - _Clark Kimberling_, Apr 28 2011

%C Van der Waerden's theorem tells us there can be no infinite binary word avoiding a monochromatic arithmetic progression of length 5 (the longest is of length 177; see A121894). However, Stewart's choral sequence has the property that it has no ababa appearing in arithmetic progression, for a different from b. - _Jeffrey Shallit_, Jul 03 2020

%D J.R. Noche, On Stewart's Choral Sequence, Gibon, 8 (2008), 1-5. [From Joel Reyes Noche (joel.noche(AT)up.edu.ph), Aug 20 2008]

%D J. R. Noche, Generalized Choral Sequences, Matimyas Matematika, 31 (2008), 25-28. [From Joel Reyes Noche (joel.noche(AT)up.edu.ph), Jul 09 2009]

%D Ian Stewart, How to Cut a Cake and Other Mathematical Conundrums, Chapter 6.

%H Antti Karttunen, <a href="/A116178/b116178.txt">Table of n, a(n) for n = 0..19683</a>

%H F. M. Dekking, <a href="https://arxiv.org/abs/2001.08915">Permutations of N generated by left-right filling algorithms</a>, arXiv:2001.08915 [math.CO], 2020.

%H Gabriele Fici and Jeffrey Shallit, <a href="https://arxiv.org/abs/2112.12125">Properties of a Class of Toeplitz Words</a>, arXiv:2112.12125 [cs.FL], 2021.

%F a(3*n) = 0, a(3*n-1) = 1 and a(3*n+1) = a(n).

%F G.f.: x^2/(1-x^3) +x^7/(1-x^9) +x^22/(1-x^27) +... . a(-1-n) = 1-a(n). - _Michael Somos_, Apr 17 2007

%F a(k)=1 if k=3^{m+1}n+(1/2)(5*3^m-1) and a(k)=0 if k=3^{m+1}n+(1/2)(3^m-1) for m,n in {0,1,2,...}. - Joel Reyes Noche (joel.noche(AT)up.edu.ph), Mar 24 2008

%t t = Nest[Flatten[# /. {0->{0,0,1}, 1->{0,1,1}}] &, {0}, 5] (*A116178*)

%t f[n_] := t[[n]]

%t Flatten[Position[t, 0]] (*A189636*)

%t Flatten[Position[t, 1]] (*A189637*)

%t s[n_] := Sum[f[i], {i, 1, n}]; s[0] = 0;

%t Table[s[n], {n, 1, 120}] (*A189638*)

%t (* _Clark Kimberling_, Apr 24 2011 *)

%o (PARI) {a(n)= if(n<0, 1-a(-1-n), if(n%3==0, 0, if(n%3==2, 1, a(n\3))))} /* _Michael Somos_, Apr 17 2007 */

%Y Cf. A010060, A189636, A189637, A189638, A121894.

%K easy,nonn

%O 0,1

%A Richard Forster (gbrl01(AT)yahoo.co.uk), Apr 15 2007

%E Formula added to the name by _Antti Karttunen_, Aug 31 2017