login
a(n) is the n-th prime of the form 2*n + k where k > 0.
0

%I #26 Sep 25 2023 07:46:53

%S 3,7,13,19,23,31,41,43,53,61,67,73,79,83,97,103,107,109,127,131,139,

%T 151,157,167,173,179,191,193,197,211,227,229,233,241,251,263,271,277,

%U 281,293,307,313,317,331,347,349,353,359,373,379,389,401,409,421,433,439

%N a(n) is the n-th prime of the form 2*n + k where k > 0.

%e 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.

%p f:= proc(n)

%p ithprime(numtheory:-pi(2*n)+n)

%p end proc:

%p map(f, [$1..100]); # _Robert Israel_, Aug 28 2023

%t a[n_] := NextPrime[2*n, n]; Array[a, 60] (* _Amiram Eldar_, Aug 28 2023 *)

%o (PARI) a(n) = prime(primepi(2*n) + n) \\ _David A. Corneth_, Aug 28 2023 after _Jon E. Schoenfield_

%o (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

%Y Cf. A000040, A060264.

%K nonn

%O 1,1

%A _Tamas Sandor Nagy_, Aug 28 2023