cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A355273 Primes p for which p + q is a multiple of 4, where q is the previous prime if p == 2 (mod 3) or the next prime otherwise.

This page as a plain text file.
%I A355273 #9 Jul 03 2022 09:18:41
%S A355273 3,5,29,31,53,59,61,73,89,137,139,149,151,157,173,179,181,191,239,241,
%T A355273 251,257,263,269,271,283,293,331,337,347,359,367,373,389,409,419,421,
%U A355273 431,433,449,509,523,541,547,557,563,569,571,577,587,593,599,601,607,631
%N A355273 Primes p for which p + q is a multiple of 4, where q is the previous prime if p == 2 (mod 3) or the next prime otherwise.
%C A355273 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.)
%C A355273 See the comment from 2017 in A068228 for an explanation.
%o A355273 (PARI) select( is(p)=if(p%3==2, precprime(p-1)+p, nextprime(p+1)+p)%4==0, primes(149))
%o A355273 (Python)
%o A355273 from sympy import nextprime
%o A355273 from itertools import islice
%o A355273 def agen():
%o A355273     p, q = 2, [3, 1]
%o A355273     while True:
%o A355273         if (p + q[int(p%3 == 2)])%4 == 0: yield p
%o A355273         p, q = q[0], [nextprime(q[0]), p]
%o A355273 print(list(islice(agen(), 54))) # _Michael S. Branicky_, Jun 26 2022
%Y A355273 Cf. A151799 (previous prime), A151800 (next prime).
%Y A355273 Cf. A068228.
%K A355273 nonn
%O A355273 1,1
%A A355273 _M. F. Hasler_ and _Yasutoshi Kohmoto_, Jun 26 2022