# I cannot seem to figure out what's wrong with the following Sage / Pari-GP code

Basically, I would like to search for primes $p$, and positive integers $y, z$ satisfying $$y < z$$ and $$1 + p^y < 2p^{2y-z}.$$

for(p=1, 10000, for(y=1, 10000, for(z=1, 10000, if(isprime(p) && y<z && 1+p^y<2p^(2y-z),print(p,"   ",y,"   ",z)))))


When I try to compile the above code using Sage Cell Server, it gives me the following error:

***   syntax error, unexpected ')': ...int(p," ",y," ",z)))))


I did already check and verified that all the parentheses are in their proper places.

edit retag close merge delete

Sort by » oldest newest most voted

Blimey! I was able to figure it out.

for(p=1, 10000, for(y=1, 10000, for(z=1, 10000, if(y < z && 1 + p^y < 2*p^(2*y-z) && isprime(p),print(p,"   ",y,"   ",z)))))


It is a common mistake of mine. I keep forgetting the * to indicate multiplication.

more Missing* (twice)

for(p=1, 10000, for(y=1, 10000, for(z=1, 10000, if(isprime(p) && y<z && 1+p^y<2*p^(2*y-z),print(p,"   ",y,"   ",z)))))

more