login
Indices where primes appear in A376198.
3

%I #10 Oct 04 2024 00:56:16

%S 2,3,9,10,11,23,24,25,26,52,53,54,55,56,57,58,59,110,111,112,113,114,

%T 115,116,117,118,119,120,121,122,231,232,233,234,235,236,237,238,239,

%U 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488

%N Indices where primes appear in A376198.

%C The primes appear in order, so a(n) is also the index of prime(n) in A376198.

%H Michael S. Branicky, <a href="/A376200/b376200.txt">Table of n, a(n) for n = 1..100000</a>

%o (Python)

%o from itertools import count, islice

%o from sympy import isprime, nextprime

%o def agen(): # generator of terms

%o an, smc, smp = 2, 4, 3

%o for n in count(2):

%o if not isprime(an):

%o an = smp if an == 2*smp else smc

%o else:

%o yield n

%o an = smp if smp < smc else smc

%o if an == smp: smp = nextprime(smp)

%o else:

%o smc += 1

%o while isprime(smc): smc += 1

%o print(list(islice(agen(), 71))) # _Michael S. Branicky_, Oct 03 2024

%Y Cf. A376198, A376199, A376201, A376750-A376754.

%K nonn

%O 1,1

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