login
Positions of 1's in A267371.
3

%I #14 Mar 23 2024 19:48:27

%S 2,5,7,10,14,17,19,21,24,26,29,32,34,38,41,43,46,51,54,56,59,63,65,68,

%T 70,73,77,80,83,85,88,92,96,99,101,104,108,111,113,115,118,120,123,

%U 127,130,132,135,138,140,143,147,150,152,154,157,159,162,165,167,170,172,175,179,182,184,186,189,191,194,197

%N Positions of 1's in A267371.

%H Michael S. Branicky, <a href="/A267374/b267374.txt">Table of n, a(n) for n = 1..10000</a>

%e In A267371, the first few terms are 0,1,0,0,1, so the first two terms of this sequence are 2, 5.

%t (* Function a267371[] is defined in A267371 *)

%t a267374[n_] := Flatten[Position[a267371[n], 1]]

%t a267374[15] (* _Hartmut F. W. Hoft_, Mar 23 2024 *)

%o (Python)

%o from itertools import count, islice

%o def bgen(): # generator of A267371

%o astr, k, mink = "01", 2, 1

%o while True:

%o yield from map(int, astr[:k])

%o for k in range(1, len(astr)+1):

%o if astr[1:].count(astr[:k]) == 0:

%o break

%o mink = max(mink, k)

%o astr += astr[:k]

%o def agen(): # generator of terms

%o yield from (n for n, an in enumerate(bgen(), 1) if an == 1)

%o print(list(islice(agen(), 70))) # _Michael S. Branicky_, Mar 23 2024

%K nonn

%O 1,1

%A _Jeffrey Shallit_, Jan 13 2016