cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A246144 Limiting block extension of A000002 (Kolakoski sequence) with first term as initial block.

This page as a plain text file.
%I A246144 #5 Nov 22 2017 01:15:03
%S A246144 1,1,2,2,1,2,1,1,2,1,2,2,1,1,2,1,1,2,1,2,2,1,2,2,1,1,2,1,1,2,2,1,2,1,
%T A246144 1,2,1,1,2,2,1,2,2,1,2,1,1,2,2,1,2,2,1,1,2,1,1,2,1,2,2,1,2,2,1,1,2,1,
%U A246144 2,2,1,2,1,1,2,2,1,2,2,1,2,1,1,2,1,2
%N A246144 Limiting block extension of A000002 (Kolakoski sequence) with first term as initial block.
%C A246144 Suppose S = (s(0), s(1), s(2), ...) is an infinite sequence such that every finite block of consecutive terms occurs infinitely many times in S.  (It is assumed that A000002 is such a sequence.)  Let B = B(m,k) = (s(m), s(m+1),...s(m+k)) be such a block, where m >= 0 and k >= 0.  Let m(1) be the least i > m such that (s(i), s(i+1),...,s(i+k)) = B(m,k), and put B(m(1),k+1) = (s(m(1)), s(m(1)+1),...s(m(1)+k+1)).  Let m(2) be the least i > m(1) such that (s(i), s(i+1),...,s(i+k)) = B(m(1),k+1), and put B(m(2),k+2) = (s(m(2)), s(m(2)+1),...s(m(2)+k+2)).  Continuing in this manner gives a sequence of blocks B'(n) = B(m(n),k+n), so that for n >= 0, B'(n+1) comes from B'(n) by suffixing a single term; thus the limit of B'(n) is defined; we call it the "limiting block extension of S with initial block B(m,k)", denoted by S^  in case the initial block is s(0).
%C A246144 The sequence (m(i)), where m(0) = 0, is the "index sequence for limit-block extending S with initial block B(m,k)", as in A246128.  If the sequence S is given with offset 1, then the role played by s(0) in the above definitions is played by s(1) instead, as in the case of A246144 and A246145.
%C A246144 Limiting block extensions are analogous to limit-reverse sequences, S*, defined at A245920.  The essential difference is that S^ is formed by extending each new block one term to the right, whereas S* is formed by extending each new block one term to the left (and then reversing).
%e A246144 S = A000002, with B = (s(1)); that is, (m,k) = (1,0)
%e A246144 S = (1,2,2,1,1,2,1,2,2,1,2,2,1,1,2,1,1,2,2,1,2,1,...)
%e A246144 B'(0) = (1)
%e A246144 B'(1) = (1,1)
%e A246144 B'(2) = (1,1,2)
%e A246144 B'(3) = (1,1,2,2)
%e A246144 B'(4) = (1,1,2,2,1)
%e A246144 B'(5) = (1,1,2,2,1,2)
%e A246144 S^ = (1,1,2,2,1,2,1,1,2,1,2,2,1,1,2,1,1,...),
%e A246144 with index sequence (1,4,13,16,51,78,97,124,178,247,322,...)
%t A246144 seqPosition1[list_, seqtofind_] := If[Length[#] > Length[list], {}, Last[Last[Position[Partition[list, Length[#], 1], Flatten[{___, #, ___}], 1, 1]]]] &[seqtofind]; n = 30; s = Prepend[Nest[Flatten[Partition[#, 2] /. {{2, 2} -> {2, 2, 1, 1}, {2, 1} -> {2, 2, 1}, {1, 2} -> {2, 1, 1}, {1, 1} -> {2, 1}}] &, {2, 2}, n], 1]; (* A246144 *)
%t A246144 Take[s, 30]
%t A246144 t = {{1}}; p[0] = seqPosition1[s, Last[t]]; s = Drop[s, p[0]]; Off[Last::nolast]; n = 1; While[(p[n] = seqPosition1[s, Last[t]]) > 0, (AppendTo[t, Take[s, {#, # + Length[Last[t]]}]]; s = Drop[s, #]) &[p[n]]; n++]; On[Last::nolast]; Last[t] (* A246144*)
%t A246144 Accumulate[Table[p[k], {k, 0, n - 1}]] (*A246145*)
%Y A246144 Cf. A246145, A246127, A246140, A246142, A000002.
%K A246144 nonn
%O A246144 1,3
%A A246144 _Clark Kimberling_ and _Peter J. C. Moses_, Aug 17 2014