login
The terms of A376201 consist of runs of successive numbers that increase by 1 at each step: a(n) is one-half of length of the n-th such run.
1

%I #15 Oct 15 2024 12:19:22

%S 2,1,1,1,2,1,3,3,6,3,1,2,1,4,1,7,2,13,7,2,5,5,13,7,1,3,3,6,7,32,4,7,

%T 10,16,8,4,4,1

%N The terms of A376201 consist of runs of successive numbers that increase by 1 at each step: a(n) is one-half of length of the n-th such run.

%C [At present it is only a conjecture that the runs have even length, but the proof should not be difficult.]

%e A376201 begins 1, 2, 3, 4, 11, 12, 27, 28, 59, 60, 123, 124, 125, 126, 255, ...

%e The runs have lengths 4,2,2,4,... so the present sequence begins 2,1,1,2,...

%o (Python)

%o from itertools import count, islice

%o from sympy import isprime, nextprime

%o def A376758_gen(): # generator of terms

%o c, a, p, q = 2, 2, 3, 4

%o for n in count(3):

%o b = min(p,q) if isprime(a) else (p if a == (p<<1) else q)

%o if b == n:

%o if b == a+1:

%o c += 1

%o else:

%o yield c>>1

%o c = 1

%o if b == p:

%o p = nextprime(p)

%o else:

%o q += isprime(q+1)+1

%o a = b

%o A376758_list = list(islice(A376758_gen(),10)) # _Chai Wah Wu_, Oct 14 2024

%Y Cf. A376198, A376201.

%K nonn,more

%O 1,1

%A _N. J. A. Sloane_, Oct 07 2024

%E a(33)-a(35) from _Michael S. Branicky_, Oct 08 2024

%E a(36)-a(38) from _Michael S. Branicky_, Oct 15 2024