NOTE: I am using % for REMAINDER.

In questions like this:

have you noticed that for two consecutive conditions, the valid number would repeat at the LCM of the condition numbers. Example for condition N%2=1 and N%3=2, numbers are 6 apart: 5,11,17 and so on. For N%3=2 and N%4=3 numbers are 12 apart: 11,23,35…

Similarly,

Valid x and y would be 35 apart.

Now one can do this manually but this trick does make it way faster. Please let me know if any discrepancies found.