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

A078687
Number of x>=0 such that prime(n)-2^x is prime.
6
0, 1, 1, 2, 2, 2, 1, 3, 2, 1, 2, 2, 1, 2, 2, 1, 1, 3, 2, 2, 2, 2, 3, 1, 1, 2, 2, 2, 2, 2, 0, 3, 1, 4, 0, 2, 2, 1, 3, 2, 1, 4, 1, 1, 2, 4, 2, 1, 3, 3, 1, 1, 3, 0, 2, 2, 1, 3, 2, 1, 2, 3, 1, 1, 2, 2, 0, 0, 2, 2, 3, 1, 2, 0, 2, 3, 1, 2, 2, 2, 1, 3, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 3, 0, 1, 3, 2, 1, 1, 3, 1, 4
OFFSET
1,4
FORMULA
a(A049084(A065381(n)))=0, a(A049084(A065380(n)))=1; A118953(n)<=a(n); a(n)=A109925(A000040(n)). - Reinhard Zumkeller, May 07 2006
EXAMPLE
prime(17)=59 and only 59-2^3 = 53 is prime hence a(17)=1
MATHEMATICA
f[p_] := Block[{c = exp = 0, lmt = 1 + Floor@ Log2@ p}, While[exp < lmt, If[ PrimeQ[p - 2^exp], c++]; exp++]; c]; Array[ f@ Prime@# &, 105] (* Robert G. Wilson v, Jul 07 2014 *)
PROG
(PARI) a(n)=sum(i=0, floor(log(prime(n))/log(2)), if(isprime(prime(n)-2^i), 1, 0))
CROSSREFS
Cf. A156695.
Sequence in context: A230243 A338898 A376115 * A133138 A348193 A194326
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Dec 17 2002
STATUS
approved