P = (2^N) - Q

MRAB python at mrabarnett.plus.com
Sun Sep 23 15:45:19 EDT 2018


On 2018-09-23 19:59, Musatov wrote:
> If P is the set of primes, how do I write a program outputting the values of Q as an integer sequence with 1 integer of Q for each N?
> 
> Let the first prime be P1
> 
> P1=2
> so if
> N=0, Q=-1
> as
> 2=(2^0) - (-1)
> 
> Let the second prime be P2
> 
> P2=3
> so if
> N=1, Q=-1
> as
> 3=(2^1) - (-1)
> 
> Let the third prime be P3
> 
> P3=5
> so if
> N=2, Q=-1
> as
> 5=(2^2) - (-1)
> 
> Let the fourth prime be P4
> 
> P4=7
> so
> N=3, Q=1
> as
> 7=(2^3) - (1)
> 
> etc.
> 
> I want an integer sequence of Q beginning...
> 
> -1,-1,-1,1...
> 
> Does this make sense?
> 
Re-arrange the equation to get Q = (2^N) - P. You should be able to work 
from that.



More information about the Python-list mailing list