0
$\begingroup$

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?

1 Answers 1

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.