login
A365241
a(n) is the n-th prime of the form 2*n + k where k > 0.
0
3, 7, 13, 19, 23, 31, 41, 43, 53, 61, 67, 73, 79, 83, 97, 103, 107, 109, 127, 131, 139, 151, 157, 167, 173, 179, 191, 193, 197, 211, 227, 229, 233, 241, 251, 263, 271, 277, 281, 293, 307, 313, 317, 331, 347, 349, 353, 359, 373, 379, 389, 401, 409, 421, 433, 439
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
Sequence in context: A105399 A133261 A113911 * A051635 A136009 A216098
KEYWORD
nonn
AUTHOR
Tamas Sandor Nagy, Aug 28 2023
STATUS
approved