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”).

A334296
Smallest k such that (2k+1)*2^n+1 is prime.
1
0, 0, 0, 2, 0, 1, 1, 2, 0, 7, 6, 4, 1, 2, 3, 2, 0, 4, 1, 5, 3, 5, 12, 22, 22, 2, 3, 7, 6, 11, 1, 17, 21, 4, 37, 29, 1, 7, 7, 2, 13, 1, 4, 4, 7, 17, 9, 13, 7, 11, 3, 8, 3, 25, 24, 2, 13, 14, 49, 13, 15, 26, 52, 4, 12, 4, 1, 4, 15, 11, 19, 19, 63, 11, 33, 2, 46
OFFSET
0,4
COMMENTS
A057775 is the corresponding sequence of primes.
LINKS
FORMULA
a(n) = (A057778(n)-1)/2.
a(n) = ((A057775(n)-1)/2^n-1)/2.
EXAMPLE
a(0)=a(1)=a(2)=0 because 2^0+1=2, 2^1+1=3, 2^2+1=5 are prime.
a(3)=2 because 2^8+1=9 and 3*2^8+1=25 are not prime, but 5*2^8+1=41 is.
MAPLE
f:= proc(n) local t, v, k;
t:= 2^n; v:= -t+1;
for k from 0 do
v:= v+2*t;
if isprime(v) then return k fi
od
end proc:
map(f, [$0..100]); # Robert Israel, Jul 14 2020
MATHEMATICA
a[n_] := Block[{k = 0}, While[! PrimeQ[(2 k + 1) 2^n + 1], k++]; k]; Array[a, 77, 0] (* Giovanni Resta, May 08 2020 *)
PROG
(Python)
from itertools import count
from sympy import isprime
def pow2p1() : # generates the sequence
for n in count() :
for k in count() :
if isprime(((2*k+1)<<n)+1) :
yield k
break
(PARI) a(n) = my(k=0); while (!isprime((2*k+1)*2^n+1), k++); k; \\ Michel Marcus, Apr 30 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Mike Speciner, Apr 21 2020
STATUS
approved