cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

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

Views

Author

Tamas Sandor Nagy, Aug 28 2023

Keywords

Examples

			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.
		

Crossrefs

Programs

  • 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 *)
  • 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