A116178 Stewart's choral sequence: a(3n) = 0, a(3n-1) = 1, a(3n+1) = a(n).
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, 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, 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
Offset: 0
References
- 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]
- 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]
- Ian Stewart, How to Cut a Cake and Other Mathematical Conundrums, Chapter 6.
Links
- Antti Karttunen, Table of n, a(n) for n = 0..19683
- F. M. Dekking, Permutations of N generated by left-right filling algorithms, arXiv:2001.08915 [math.CO], 2020.
- Gabriele Fici and Jeffrey Shallit, Properties of a Class of Toeplitz Words, arXiv:2112.12125 [cs.FL], 2021.
- Robbert Fokkink and Gandhar Joshi, Anti-recurrence sequences, arXiv:2506.13337 [math.NT], 2025. See pp. 12, 18.
Programs
-
Mathematica
t = Nest[Flatten[# /. {0->{0,0,1}, 1->{0,1,1}}] &, {0}, 5] (*A116178*) f[n_] := t[[n]] Flatten[Position[t, 0]] (*A189636*) Flatten[Position[t, 1]] (*A189637*) s[n_] := Sum[f[i], {i, 1, n}]; s[0] = 0; Table[s[n], {n, 1, 120}] (*A189638*) (* Clark Kimberling, Apr 24 2011 *)
-
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 */
Formula
a(3*n) = 0, a(3*n-1) = 1 and a(3*n+1) = a(n).
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
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
Extensions
Formula added to the name by Antti Karttunen, Aug 31 2017
Comments