OFFSET
1,1
COMMENTS
EXAMPLE
According to the definition in A348168, prime numbers are divided into sublists, L_1, L_2, L_3,..., in which L_n = [p(n,1), p(n,2), ..., p(n,m(n))], where p(n,k) is the k-th prime and m(n) the number of primes in the n-th sublist L_n. Thus, a(n) = p(n,1). The first sublist L_1 = [2]. If p(n,1) <= (prevprime(p(n,1)) + nextprime(p(n,1)))/2, then L_n has only 1 prime, p(n,1). Otherwise, m(n) is the largest integer such that g(n,1) >= g(n,i), where g(n,i) = p(n,i+1) - p(n,i) and 2 <= i <= m(n).
The first 32 primes, for example, are divided into 16 prime sublists: [2], [3], [5], [7], [11,13], [17,19], [23], [29,31], [37,41,43,47], [53], [59,61], [67,71,73], [79,83], [89], [97,101,103,107,109,113], [127,131]. The leading primes in these sublists are: 2, 3, 5, 7, 11, 17, 23, 29, 37, 53, 59, 67, 79, 89, 97, 127. Therefore, a(1) = 2, a(2) = 3, ..., and a(16) = 127.
PROG
(Python)
from sympy import nextprime; R = [2]; L = [2]
for n in range(2, 57):
p0 = L[-1]; p1 = nextprime(p0); M = [p1]; g0 = p1-p0; p = nextprime(p1); g1 = p-p1
while g1 < g0 and p-p1 <= g1: M.append(p); p1 = p; p = nextprime(p)
L = M; R.append(L[0])
print(*R, sep =', ')
CROSSREFS
KEYWORD
nonn
AUTHOR
Ya-Ping Lu, Apr 04 2023
STATUS
approved