

A250005


a(n) = 1, unless forbidden by the "iterated cubefree rule", in which case a(n) = 2.


2



1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,3


COMMENTS

Inspired by the Kolakoski sequence A000002.
The "iterated cubefree rule" defined here means that the sequence a does not contain words repeated three times, and neither does any of the sequences RL^n(a), n >= 0, where RL is the runlength transform (in other words, the sequence a is smooth, that is differentiable arbitrarily many times  see for example the link by Fedou and Fici for a definition of differentiable sequences). The OK sequence A000002 obviously satisfies this rule because RL(OK)=OK.
The patterns appearing in this sequence look very similar to those in A000002. Indeed, the frequency of terms which value is not constrained by the iterated cubefree rule diminishes as n increases in both sequences and seems to tend to zero (A250006 gives the ranks of these terms for this sequence).
Thus all binary sequence satisfying the iterated cubefree rule might share similar limiting properties, in particular: does the limiting frequency of 1's exist for such a sequence? If yes, is it equal to 1/2, despite the priority given to 1's in this sequence?


LINKS

JeanChristophe Hervé, Table of n, a(n) for n = 1..10000
F. M. Dekking, On the structure of selfgenerating sequences, Seminar on Number Theory, 19801981 (Talence, 19801981), Exp. No. 31, 6 pp., Univ. Bordeaux I, Talence, 1981. Math. Rev. 83e:10075.
J. M. Fedou and G. Fici, Some remarks on differentiable sequences and recursivity, Journal of Integer Sequences 13(3): Article 10.3.2 (2010).
C. Kimberling, Integer Sequences and Arrays, Illustration of the Kolakoski sequence
W. Kolakoski and N. Ucoluk, Problem 5304: Self Generating Runs, Amer. Math. Monthly, 72 (1965), 674; 73 (1966), 681682.


EXAMPLE

a(1)=a(2)=1 because it is not forbidden by the cubefree rule. But a(3) cannot be equal to 1, thus a(3)=2; Then a(4)=a(5)= 1, a(6)=2, a(7) = 1 but a(8)=2, because otherwise we would have the cube 112112112.


PROG

(R)
runlen< function(seq) {
n< length(seq)
if(n==1) return(c())
else {rl<c()
i<1
while(i < n) { k<1
while(i+k<=n) {
if(seq[i+k]!=seq[i]) break
else k<k+1}
if (i+k!=2) rl<c(rl, k)
i<i+k }
return(rl)}}
# following recursive function not optimized
isOK<function(x, seq) {
n<length(seq)
if(n<=1) return(1)
if(seq[n]==seq[n1]&seq[n1]==x) return(0)
rl<runlen(c(seq, x))
lrl<length(rl)
return(isOK(rl[lrl], rl[1:lrl1]))}
sequence<function(n) {
if(n<=0) return(c())
seq<c(1)
for(i in 2:n) {
if(isOK(1, seq)) seq<c(seq, 1)
else seq<c(seq, 2)}
return(cbind(c(1:n), seq))}


CROSSREFS

Cf. A000002, A250006.
Sequence in context: A227796 A109374 A079706 * A319907 A078703 A090629
Adjacent sequences: A250002 A250003 A250004 * A250006 A250007 A250008


KEYWORD

nonn


AUTHOR

JeanChristophe Hervé, Nov 10 2014


STATUS

approved



