A094076 Smallest k such that prime(n) + 2^k is prime, or -1 if no such prime exists.
0, 1, 1, 2, 1, 2, 1, 2, 3, 1, 4, 2, 1, 2, 5, 3, 1, 8, 2, 1, 4, 2, 7, 3, 2, 1, 2, 1, 2, 7, 2, 3, 1, 10, 1, 4, 4, 2, 5, 3, 1, 4, 1, 2, 1, 6, 4, 2, 1, 2, 3, 1, 4, 5, 9, 3, 1, 20, 2, 1, 6, 7, 2, 1, 2, 5, 4, 4, 1, 2, 27, 3, 4, 4, 2, 15, 3, 2, 3, 10, 1, 8, 1, 4, 2, 7, 3, 2, 1, 2, 5, 3, 2, 3, 2, 7, 5, 1, 6, 4, 4, 9, 3, 1
Offset: 1
Keywords
Examples
p = 773, k = 995, p + 2^k is prime. p = 5101, k = 5760, p + 2^k is prime.
References
- A. O. L. Atkin and B. J. Birch, eds., Computers in Number Theory, Academic Press, 1971, page 74.
Links
- Jinyuan Wang, Table of n, a(n) for n = 1..7771 (terms 1..3000 from Charles R Greathouse IV).
- P. Erdős, On integers of the form 2^k + p and some related problems, Summa Brasil. Math. 2 (1950), pp. 113-123. [From Bruno Mishutka (bruno.mishutka(AT)googlemail.com), Mar 11 2009]
- Charles R Greathouse IV, Constructing a covering set for numbers 2^k + p [Cached copy]
Programs
-
Mathematica
sk[n_]:=Module[{p=Prime[n],k=1},While[!PrimeQ[p+2^k],k++];k]; Join[{0}, Array[sk,110,2]] (* Harvey P. Dale, Jul 07 2013 *)
-
PARI
pplus2ton(n,m) = { local(k,s,p,y,flag); s=0; forprime(p=2,n, flag=1; for(k=0,m, y=p+2^k; if(ispseudoprime(y), print1(k, ", "); s++; flag=0; break) ); if(flag, return(p))); print(); print(s); } \\ Cino Hilliard, Jun 27 2005
Extensions
More terms from Don Reble, May 02 2004
More terms from Cino Hilliard, Jun 27 2005
More terms from Charles R Greathouse IV, Feb 08 2008
Comments