OFFSET
1,1
COMMENTS
Naively one might expect p + precprime / nextprime congruent to 0 or to 2 (mod 4) with equal probability. It turns out that, following the given rule, the case 2 is much more frequent than the case 0, especially for small primes. (Observation by Y. Kohmoto.)
See the comment from 2017 in A068228 for an explanation.
PROG
(PARI) select( is(p)=if(p%3==2, precprime(p-1)+p, nextprime(p+1)+p)%4==0, primes(149))
(Python)
from sympy import nextprime
from itertools import islice
def agen():
p, q = 2, [3, 1]
while True:
if (p + q[int(p%3 == 2)])%4 == 0: yield p
p, q = q[0], [nextprime(q[0]), p]
print(list(islice(agen(), 54))) # Michael S. Branicky, Jun 26 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler and Yasutoshi Kohmoto, Jun 26 2022
STATUS
approved