Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.