login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A245462
a(1)=1, then a(n) is the smallest odd k > floor(a(n-1)/2)+1 such that k*2^n+1 is prime.
1
1, 3, 5, 7, 11, 7, 5, 13, 15, 13, 9, 15, 23, 39, 35, 21, 21, 33, 27, 25, 33, 25, 45, 45, 33, 27, 15, 13, 23, 49, 35, 43, 99, 75, 59, 81, 63, 63, 81, 57, 99, 73, 51, 27, 35, 19, 27, 15, 23, 27, 17, 25, 51, 49, 35, 27, 29, 99, 71, 45
OFFSET
1,2
COMMENTS
A134855(n) = smallest odd k such that k*2^n+1 is prime, the primes are not always in increasing order.
Here the primes k*2^n+1 are always in increasing order.
The ratio sum{k for n=1 to N}/sum{n for n=1 to N} is ~ 2*log(2) as N increases.
MATHEMATICA
a[n_] := Block[{k = Floor[ a[n - 1]/2] + 2}, If[ EvenQ[k], k++]; While[ !PrimeQ[k*2^n + 1], k += 2]; k]; a[1] = 1; Array[a, 60] (* Robert G. Wilson v, Jul 26 2014 *)
PROG
(PFGW & SCRIPT)
SCRIPT
DIM j, -1
DIM n, 0
DIMS t
OPENFILEOUT myf, a(n).txt
LABEL loop1
SET n, n+1
IF n>6000 THEN END
LABEL loop2
SET j, j+2
SETS t, %d, %d\,; n; j
PRP j*2^n+1, t
IF ISPRP THEN GOTO a
GOTO loop2
LABEL a
WRITE myf, t
SET j, j/2
IF j%2==0 THEN SET j, j+1
GOTO loop1
(PARI) a=[1]; for(n=2, 100, k=floor(a[n-1]/2)+2; if(k%2==0, k++); t=2^n; while(!isprime(k*t+1), k+=2); a=concat(a, k)); a \\ Colin Barker, Jul 23 2014
CROSSREFS
Sequence in context: A335301 A235379 A174839 * A338842 A022457 A066066
KEYWORD
nonn
AUTHOR
Pierre CAMI, Jul 22 2014
STATUS
approved