login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A353697 a(n) is the least prime p such that, if q is the next prime after p and d = q-p, then p-n*d, p+n*d, q-n*d and q+n*d are all prime. 1

%I #18 Sep 08 2022 08:16:04

%S 47,131641,11,2417,53,17,8389,53,43,167,167,1171,137537,167,41,557,

%T 80111,241,5387,131,59,6917,13187,59,157,2861,887,14251,367,229,1367,

%U 72767,71,257,233,163,4297,233,149,263,257,547,4831,1499,101,1217,66191,101,647,353,919,7759,18553,223,971

%N a(n) is the least prime p such that, if q is the next prime after p and d = q-p, then p-n*d, p+n*d, q-n*d and q+n*d are all prime.

%H Robert Israel, <a href="/A353697/b353697.txt">Table of n, a(n) for n = 1..10000</a>

%e a(3) = 11 because p = 11 is prime, the next prime is q = 13, d = 2, and p-3*d = 5, p+3*d = 17, q-3*d = 7, and q+3*d = 19 are prime; and this is the least prime that works.

%p f:= proc(n) local p,q,c;

%p q:= 2:

%p do

%p p:= q; q:= nextprime(q); d:= q-p;

%p if isprime(p-n*d) and isprime(p+n*d) and isprime(q-n*d) and isprime(q+n*d) then return p fi

%p od;

%p end proc:

%p map(f, [$1..100]);

%t a[n_] := Module[{p = 2, q = 3, d = 1}, While[! AllTrue[{p - n*d, p + n*d, q - n*d, q + n*d}, # > 0 && PrimeQ[#] &], p = q; q = NextPrime[q]; d = q - p]; p]; Array[a, 55] (* _Amiram Eldar_, Sep 06 2022 *)

%o (Python)

%o from sympy import isprime, nextprime

%o def a(n):

%o p = nextprime(2*n); q = nextprime(p); d = q-p

%o while not all(isprime(t) for t in [p-n*d, p+n*d, q-n*d, q+n*d]):

%o p = q; q = nextprime(q); d = q-p

%o return p

%o print([a(n) for n in range(1, 56)]) # _Michael S. Branicky_, Sep 05 2022

%K nonn,look

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Sep 05 2022

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 28 14:13 EDT 2024. Contains 375507 sequences. (Running on oeis4.)