OFFSET
1,1
EXAMPLE
a(3) = 13 because at k = 1, 2 * 3 + 1 = 7, this being the first prime result of the sum. At k = 2, the sum is 8, which is not a prime, so trying incremental k's, the second prime 11 is found with k = 5. The third prime at n = 3 and k = 7 is found to be 13, therefore a(3) = 13.
MAPLE
f:= proc(n)
ithprime(numtheory:-pi(2*n)+n)
end proc:
map(f, [$1..100]); # Robert Israel, Aug 28 2023
MATHEMATICA
a[n_] := NextPrime[2*n, n]; Array[a, 60] (* Amiram Eldar, Aug 28 2023 *)
PROG
(PARI) a(n) = prime(primepi(2*n) + n) \\ David A. Corneth, Aug 28 2023 after Jon E. Schoenfield
(PARI) first(n) = {my(res = vector(n), ind = 1, nextpp = 2, pp = 2); forprime(p = 3, oo, if(pp >= nextpp, res[ind] = p; if(isprime(2*ind+1), nextpp+=2, nextpp+=1); ind++; if(ind > n, return(res))); pp++; )} \\ David A. Corneth, Aug 28 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Tamas Sandor Nagy, Aug 28 2023
STATUS
approved