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.

A256787 Smallest odd number k such that k*2^(2*n+1)+1 is a prime number.

Original entry on oeis.org

1, 5, 3, 5, 15, 9, 5, 5, 9, 11, 11, 45, 5, 15, 23, 35, 9, 59, 15, 5, 3, 9, 35, 27, 23, 17, 51, 5, 29, 27, 53, 9, 9, 9, 23, 39, 23, 5, 29, 249, 9, 51, 5, 75, 51, 117, 29, 77, 131, 219, 221, 29, 53, 105, 321, 95, 179, 197, 101, 51, 81, 101, 11, 5, 21, 221, 53
Offset: 0

Views

Author

Pierre CAMI, Apr 10 2015

Keywords

Comments

As N increases, (Sum_{n=1..N} a(n))/(Sum_{n=1..N} n) appears to tend to log(2), as can be seen by plotting the first 10000 terms.
This observation is consistent with the prime number theorem as the probability that k*2^n+1 is prime is 1/(n*log(2)+log(k)) so ~ 1/(n*log(2)) as n increases, if k ~ n*log(2) then k/(n*log(2)) ~ 1.

Examples

			1*2^(2*0+1)+1=3 is prime, so a(0)=1.
1*2^(2*1+1)+1=9 and 3*2^(2*1+1)+1=25 are composite, 5*2^(2*1+1)+1=41 is prime, so a(1)=5.
		

Programs

  • Maple
    for n from 0 to 100 do
    R:= 2^(2*n+1);
    for k from 1 by 2 do
       if isprime(k*R+1) then A[n]:= k; break fi
    od:
    od:
    seq(A[n],n=0..100); # Robert Israel, Apr 24 2015
  • Mathematica
    f[n_] := Block[{g, i, k}, g[x_, y_] := y*2^(2*x + 1) + 1; Reap@ For[i = 0, i <= n, i++, k = 1; While[Nand[PrimeQ[g[i, k]] == True, OddQ@ k], k++]; Sow@ k] // Flatten // Rest]; f@ 66 (* Michael De Vlieger, Apr 18 2015 *)
  • PARI
    vector(100, n, n--; k=1; while(!isprime(k*2^(2*n+1)+1), k+=2); k) \\ Colin Barker, Apr 10 2015