I have an equation y*8.57E-7 = x
with the constraints:
x>0
x
should be an integery
should be an integer
It might be solved with dynamic programming, but I am weak in analyzing it this way. For me the simple solution was to use brute force. But as expected it takes too much time, and it should be as we don't know in what domain the solution would lie. I also tried to use excel 'solve' but it is too abstract for this problem (I couldn't add 3rd constraint in it).
SO, what you guys do to solve these problems fast and in a better way. I usually counter these problems quite frequently, so there should be something to solve it fast or you can write anything on best practices and something or on some general appraoch. Maybe something using heuristics.
Here is my brute force code:
for x in range(1, 1000000000):
y = int(1 / (x * 8.57E-7))
if x * y * 8.57E-7 == 1:
print(f"{x=}, {y=}")
(No solution whatsoever)