login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A092938
a(n) = least prime p such that 2*prime(n) - p is prime.
3
2, 3, 3, 3, 3, 3, 3, 7, 3, 5, 3, 3, 3, 3, 5, 3, 5, 13, 3, 3, 7, 7, 3, 5, 3, 3, 7, 3, 7, 3, 3, 5, 3, 7, 5, 19, 3, 13, 3, 29, 5, 3, 3, 3, 5, 19, 3, 3, 5, 19, 3, 11, 3, 3, 5, 3, 17, 19, 7, 5, 3, 17, 7, 3, 7, 3, 3, 13, 3, 7, 5, 17, 7, 3, 7, 5, 5, 7, 5, 7, 11, 3, 3, 3, 19, 3, 11, 3, 3, 7, 5, 5, 3, 5, 7, 23, 5, 3
OFFSET
1,1
COMMENTS
a(n) = least prime p such that prime(n) = (p+q)/2, where q is also prime.
a(n) <= prime(n). Conjecture: a(n) = prime(n) only for n = 1 and 2.
LINKS
EXAMPLE
2*prime(8) = 38; 38 - 2 = 36, 38 - 3 = 35, 38 - 5 = 33 are composite, but 38 - 7 = 31 is prime. Hence a(8) = 7.
MAPLE
f:= proc(n) local pn, p;
pn:= ithprime(n);
p:= 1;
do
p:= nextprime(p);
if isprime(2*pn-p) then return p fi
od
end proc:
map(f, [$1..100]); # Robert Israel, Jul 31 2020
MATHEMATICA
a[n_] := Module[{p, q = Prime[n]}, For[p = 2, True, p = NextPrime[p], If[PrimeQ[2q-p], Return[p]]]];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Feb 07 2023 *)
PROG
(PARI) {for(n=1, 98, k=2*prime(n); p=2; while(!isprime(k-p), p=nextprime(p+1)); print1(p, ", "))} \\ Klaus Brockhaus, Dec 23 2006
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Mar 23 2004
EXTENSIONS
Edited and extended by Klaus Brockhaus, Dec 23 2006
STATUS
approved