Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #20 Mar 24 2024 09:56:02
%S 0,2,5,9,12,14,17,20,25,28,32,36,39,43,46,49,52,56,59,61,64,67,71,74,
%T 76,80,83,87,90,92,95,99,102,106,109,111,114,117,119,123,126,130,133,
%U 138,140,143,147,150,156,159,163,166,168,171,174,179,183,186,190,193,195,198
%N Count of iteration steps for the iterates in A267371 that end in 1.
%C Conjecture: If iterate m terminates with prefix s ending in 1 then the subsequent iterate of A267371 is terminated by prefix s0.
%H Michael S. Branicky, <a href="/A371440/b371440.txt">Table of n, a(n) for n = 0..4000</a>
%e a(0) = 0 since the initial string for the iteration process is 01.
%e a(2) = 5 since the first 5 prefixes are 0, 01, 010, 0100 and 0100101 determining the iterate 0100101001000100101 of length 19. The next prefix in the iteration process is 01001010.
%t (* function preLo[ ] is defined in A267371 *)
%t lastChar[n_] := Map[StringTake[Last[#], -1]&, NestList[{preLo[#], StringJoin[#[[2]], StringTake[#[[2]], preLo[#]]]}&, {1, "01"}, n]]a371440[n_] := Flatten[Position[lastChar[n], "1"]-1]a371440[200]
%o (Python)
%o from itertools import count, islice
%o def agen(): # generator of terms
%o astr, k, mink = "01", 2, 1
%o for i in count(0):
%o if astr[-1] == "1": yield i
%o for k in range(mink, len(astr)+1):
%o if astr[1:].count(astr[:k]) == 0:
%o break
%o mink = max(mink, k)
%o astr += astr[:k]
%o print(list(islice(agen(), 62))) # _Michael S. Branicky_, Mar 23 2024
%Y Cf. A267371.
%K nonn
%O 0,2
%A _Hartmut F. W. Hoft_, Mar 23 2024