OFFSET
2,2
LINKS
Robert Israel, Table of n, a(n) for n = 2..10000
FORMULA
a(n) = pi(A020481(n)).
MAPLE
f:= proc(n) local i, p;
p:= 1:
for i from 1 do
p:= nextprime(p);
if isprime(2*n-p) then return i fi
od
end proc:
map(f, [$2..100]); # Robert Israel, Nov 19 2024
MATHEMATICA
Table[Module[{i = 1}, While[i <= PrimePi[n] && ! PrimeQ[n - Prime[i]], i++]; If[i <= PrimePi[n], i, None]], {n, 4, 1000, 2}]
PROG
(PARI) a(n) = my(i=1); while (!isprime(2*n-prime(i)), i++); i; \\ Michel Marcus, Nov 06 2024
(Python)
from sympy import primerange, isprime
def A377758(n): return next(i for i, p in enumerate(primerange(2*n), 1) if isprime((n<<1)-p)) # Chai Wah Wu, Nov 19 2024
CROSSREFS
KEYWORD
nonn,new
AUTHOR
Michel Eduardo Beleza Yamagishi, Nov 06 2024
STATUS
approved