I'm solving an algorithm problem and it boils down to solving the congruency $dp \equiv s \mod N$ for the smalest value of $d$. Is there a way I can use number theory to solve this?
Values of $d$ in a congruence problem $dp \equiv s \mod N$
0
$\begingroup$
number-theory
elementary-number-theory
divisibility
1 Answers
2
Your congruence will have a solution if and only if $\gcd(p,\ N)=g| s$ and there will be $g$ solutions modulo $N$.
The general solution is given by the extended Euclidean algorithm. See the linear congruence theorem and the extended Euclidean algorithm which outlines a method of solution.