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.

A334296 Smallest k such that (2k+1)*2^n+1 is prime.

This page as a plain text file.
%I A334296 #31 Jul 14 2020 21:39:16
%S A334296 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,
%T A334296 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,
%U A334296 15,26,52,4,12,4,1,4,15,11,19,19,63,11,33,2,46
%N A334296 Smallest k such that (2k+1)*2^n+1 is prime.
%C A334296 A057775 is the corresponding sequence of primes.
%H A334296 Robert Israel, <a href="/A334296/b334296.txt">Table of n, a(n) for n = 0..2000</a>
%F A334296 a(n) = (A057778(n)-1)/2.
%F A334296 a(n) = ((A057775(n)-1)/2^n-1)/2.
%e A334296 a(0)=a(1)=a(2)=0 because 2^0+1=2, 2^1+1=3, 2^2+1=5 are prime.
%e A334296 a(3)=2 because 2^8+1=9 and 3*2^8+1=25 are not prime, but 5*2^8+1=41 is.
%p A334296 f:= proc(n) local t, v, k;
%p A334296    t:= 2^n; v:= -t+1;
%p A334296    for k from 0 do
%p A334296       v:= v+2*t;
%p A334296       if isprime(v) then return k fi
%p A334296    od
%p A334296 end proc:
%p A334296 map(f, [$0..100]); # _Robert Israel_, Jul 14 2020
%t A334296 a[n_] := Block[{k = 0}, While[! PrimeQ[(2 k + 1) 2^n + 1], k++]; k]; Array[a, 77, 0] (* _Giovanni Resta_, May 08 2020 *)
%o A334296 (Python)
%o A334296 from itertools import count
%o A334296 from sympy import isprime
%o A334296 def pow2p1() : # generates the sequence
%o A334296   for n in count() :
%o A334296     for k in count() :
%o A334296       if isprime(((2*k+1)<<n)+1) :
%o A334296         yield k
%o A334296         break
%o A334296 (PARI) a(n) = my(k=0); while (!isprime((2*k+1)*2^n+1), k++); k; \\ _Michel Marcus_, Apr 30 2020
%Y A334296 Cf. A057778, A057775, A035050, A035089.
%K A334296 nonn
%O A334296 0,4
%A A334296 _Mike Speciner_, Apr 21 2020