Sorry for the horrible title - I'm new to python and I'm not sure how to describe my question. So the question asks:
x plus 100 is a perfect square number, plus another 168 is also a perfect square number. Find x.
And here's my answer:
from math import sqrt
for x in range(-100,10000):
a=int(sqrt(x+100))
b=int(sqrt(x+100+168))
if (a*a!=x+100) or (b*b!=x+100+168):
continue
else:
print(x)
The problem is, I don't actually know the range. I only know that the number can't be smaller than -100, but the 10000 is only a random large number that I put in there. Is there a way for me to figure out a smaller range first? Or a way that I could make this faster?