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.

A337754 Least prime p such that 2p+1, 2p+3,..., 2p+2n+1 are not prime.

This page as a plain text file.
%I A337754 #23 Jul 31 2021 09:15:11
%S A337754 7,31,59,59,263,263,263,691,977,1091,1487,1487,2417,2797,4987,4987,
%T A337754 6427,9811,9811,12739,12739,12739,17033,17033,17033,17033,17033,17033,
%U A337754 67261,77969,77969,77969,77969,77969,140717,140717,140717,169019,169019,169019,180331
%N A337754 Least prime p such that 2p+1, 2p+3,..., 2p+2n+1 are not prime.
%H A337754 Michael S. Branicky, <a href="/A337754/b337754.txt">Table of n, a(n) for n = 0..207</a>
%e A337754 a(1) = 31 because 2*31+1=63 and 2*31+3=65 are not prime.
%p A337754 nn:=10^8:
%p A337754 for n from 1 to 50 do:
%p A337754 ii:=0:
%p A337754   for k from 2 to nn while(ii=0)do:
%p A337754     p:=ithprime(k):jj:=0:
%p A337754      for i from 1 by 2 to 2*n-1 do:
%p A337754       if isprime(2*p+i)
%p A337754        then
%p A337754        jj:=1:
%p A337754        else
%p A337754       fi:
%p A337754      od:
%p A337754        if jj=0
%p A337754         then
%p A337754         ii:=1: printf(`%d, `,p):
%p A337754         else
%p A337754        fi:
%p A337754      od:
%p A337754    od:
%o A337754 (PARI) isok(p, n) = {forstep(k=1, 2*n+1, 2, if (isprime(2*p+k), return (0));); return(1);}
%o A337754 a(n) = {my(p=2); while(!isok(p, n), p = nextprime(p+1)); p;} \\ _Michel Marcus_, Sep 21 2020
%o A337754 (Python)
%o A337754 from sympy import isprime, nextprime
%o A337754 def a(n, startp=2):
%o A337754     p = startp
%o A337754     while any(isprime(2*p+i) for i in range(1, 2*n+2, 2)): p = nextprime(p)
%o A337754     return p
%o A337754 print([a(n) for n in range(41)]) # _Michael S. Branicky_, Jul 31 2021
%o A337754 (Python) # uses above to produce initial segment faster
%o A337754 def aupton(nn):
%o A337754     an, alst = 2, []
%o A337754     for n in range(nn+1): an = a(n, startp=an); alst.append(an)
%o A337754     return alst
%o A337754 print(aupton(40)) # _Michael S. Branicky_, Jul 31 2021
%Y A337754 Cf. A230225.
%K A337754 nonn
%O A337754 0,1
%A A337754 _Michel Lagneau_, Sep 21 2020