Let p, q and A be three positive integers. I have the following equation:
$$(A mod p) mod q = (A mod q)mod p$$
Find all the ordered pairs $(p, q)$ which satisfy the above equation such that $$1 <=p < q <= N$$ and $N$ <= $10^7$, $A<=10^7$.
My approach:
As p is less than $q$ in LHS, $$(A modp) modq = Amodp$$
Now $$Amodp = (A mod q)mod p$$
If we consider $Amodq = X$ (some constant), then $$A = Amodq$$
Which is only possible when $A< q$.
I'm not able to proceed ahead. Kindly help.