OFFSET
2,1
COMMENTS
a(n) = 0 for odd primes prime(n) appearing in A065381.
Primes p(n) for which there is no such prime a(n) (in which case a(n)=0) are listed in A065381 = (2,127,149,251,331,337,373,...). - M. F. Hasler, Nov 23 2008
LINKS
Ivan Neretin, Table of n, a(n) for n = 2..10000
EXAMPLE
Looking at the primes less than the 10th prime = 29: 29 - 23 = 6, not a power of 2. 29-19 = 10, not a power of 2. 29-17 = 12, not a power of 2. But 29-13 = 16, a power of 2. Since p = 13 is the largest prime p such that 29 - p = a power of 2, then a(10) = 13.
MATHEMATICA
Table[Max[0, Select[# - 2^Range[0, Log2@#] &@Prime[n], PrimeQ]], {n, 2, 63}] (* Ivan Neretin, Jun 10 2018 *)
PROG
(PARI) A152073(n)=local( q=n=prime(n)); while( q=precprime(q-1), n-q==1<<valuation(n-q, 2) && return(q)) \\ M. F. Hasler, Nov 23 2008
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Leroy Quet, Nov 23 2008
EXTENSIONS
Edited and extended by M. F. Hasler and Ray Chandler, Nov 23 2008
STATUS
approved