OFFSET
0,2
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.
LINKS
Pierre CAMI, Table of n, a(n) for n = 0..10000
EXAMPLE
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.
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 *)
PROG
(PFGW & SCRIPT)
SCRIPT
DIM i
DIM n, -1
DIMS t
OPENFILEOUT myf, a(n).txt
LABEL loop1
SET n, n+2
SET i, -1
LABEL loop2
SET i, i+2
SETS t, %d, %d\,; n; i
PRP i*2^n+1, t
IF ISPRP THEN GOTO a
GOTO loop2
LABEL a
WRITE myf, t
GOTO loop1
(PARI) vector(100, n, n--; k=1; while(!isprime(k*2^(2*n+1)+1), k+=2); k) \\ Colin Barker, Apr 10 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Apr 10 2015
STATUS
approved