[seqfan] Re: 2^k - prime(p) or prime(p) - 2^k ?

Maximilian Hasler maximilian.hasler at gmail.com
Wed Apr 10 18:05:15 CEST 2013


On Wed, Apr 10, 2013 at 9:14 AM, Charles Greathouse wrote:
>> Hello, SegFans, Primes p of the form 2^k - prime(p) for some k:  3, 5,
> 503,...?
>
> How would you prove the absence of a term?

you check whether p+prime(p) = 2^k :

forprime(p=1,default(primelimit),(t=p+prime(p))==1<<valuation(t,2) &
print1(p","))

3,5,503,

(no other term < primepi(10^8)

> And what about 11 = 16 - 5, 13 = 16 - 3,

these yield the given 5 and 3 AFAICS.

> 19 = 128 - 109, 23 = 64 - 41, 29 = 32 - 3, and so forth?

109 =!= prime(19) etc.


> Primes p of the form prime(p) - 2^k for some  k:  2, 3,...?

n=0;forprime(p=1,10^8,isprime(n++)||next;(t=p-n)==1<<valuation(t,2)&print1(n","))
\\(incredibly much faster (factor 100 at least) than the above code!!) starts:

2,3,4189897,

(no other term < primepi(10^8))

Note that 4189897 is in A091020.


Maximilian



More information about the SeqFan mailing list