%I #49 Jan 08 2021 20:30:11
%S 2,6,6,6,0,10,28,6,10,6,6,6,0,0,6,28,10,6,10,6,6,0,6,6,0,6,6,6,6,6,6,
%T 52,6,6,6,6,6,6,6,6,6,6,6,28,6,0,0,28,6,6,6,6,6,0,6,6,6,10,6,6,6,6,0,
%U 6,0,6,6,6,6,0,6,6,6,0,6,6,6,0,10,0,10,6,6
%N Period of orbit of Post's tag system applied to the word (100)^n (version 2), or -1 if the orbit increases without limit.
%C Post's tag system maps a word w over {0,1} to w', where if w begins with 0, w' is obtained by appending 00 to w and deleting the first three letters, or if w begins with 1, w' is obtained by appending 1101 to w and deleting the first three letters.
%C The empty word is included in the count.
%C Here, following Asveld, a(n)=0 if the orbit ends at the empty word. On the other hand, Shallit defines a(n) to be 1 if that happens, which gives a different sequence, A284121.
%C From _A.H.M. Smeets_, Jul 16 2020: (Start)
%C In general a tag as defined by Emil Leon Post, is given by a 4-tuple (Sigma,AF,n,w0), where Sigma is some (nonempty) alphabet, AF is the associated function (sometimes also called set of production rules) AF: Sigma -> Sigma*, n is the deletion number and w0 the initial string.
%C Here, the period lengths a(n) refer to the tags ({0,1},{(0,00),(1,1101)},3,100^n).
%C a(n) is an even number. Proof: for each cycle the number of associations (productions) 0 -> 00 must equal the number of associations (productions) 1 -> 1101 applied within a cycle. (End)
%H Lars Blomberg, <a href="/A291793/b291793.txt">Table of n, a(n) for n = 1..6075</a> (corrected for n=165 by _A.H.M. Smeets_)
%H Peter R. J. Asveld, <a href="http://doc.utwente.nl/66184/1/1988m20.pdf">On a Post's System of Tag</a>. Bulletin of the EATCS 36 (1988), 96-102.
%H Lars Blomberg, <a href="/A291793/a291793.png">Histogram over non-zero terms</a>
%H Emil L. Post, <a href="http://www.lib.ysu.am/articles_art/63062f3ed126193beb426becc0fbbe33.pdf">Formal reductions of the general combinatorial decision problem.</a>, American Journal of Mathematics, Vol. 65, No. 2 (Apr., 1943), pp. 197-215.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/TagSystem.html">Tag System</a>
%e For n = 2 the orbit of (100)^2 = 100100 consists of a preperiod of length 15, followed by a periodic portion of length 6.
%o (Python)
%o def step(w):
%o i = 0
%o while w[0] != alfabet[i]:
%o i = i+1
%o w = w+suffix[i]
%o return w[n:len(w)]
%o alfabet, suffix, n, ws, w0, m = "01", ["00","1101"], 3, "100", "", 0
%o while m < 83:
%o w0, m = w0+ws, m+1
%o w, ww, i, a = w0, w0, 0, 0
%o while w != "" and a == 0:
%o w, i = step(w), i+1
%o if i%1000 == 0:
%o ww = w
%o else:
%o if w == ww or w == "":
%o if w != "":
%o a = i%1000
%o print(m,a) # _A.H.M. Smeets_, Jul 16 2020
%Y Cf. A284116, A284119, A291792, A284121, A336287, A336327.
%K nonn
%O 1,1
%A _N. J. A. Sloane_, Sep 04 2017, based on _Jeffrey Shallit_'s A284121.
%E a(50)-a(83) from _Lars Blomberg_, Sep 08 2017