Guys, I’m looking for algorithmic solution for following task. Suppose we have array Q. let’s say Q is size of 3. I wanna find such P, that by MODing Q[i] mod P gives me Z. so basically

Q[1] mod P = Z
Q[2] mod P = Z
Q[3] mod P = Z

where Q[1] != Q[2] != Q[3]

In case if I take out any of Q[i] value, I will need to find P’ that does following

Q[1] mod P’ = W
Q[2] mod P’ = W

I’d appreciate any suggestion. If any of you has ever heard/done something like this, please let me know. It’d help a lot with one of my program.

Thanks in advance