I have a discrete log that I need to solve to aid in a Cryptography problem, that deals with both programming and mathematics, so I was unsure where to post this problem, feel free to move me if needed. I must use Index-Calculus to solve this discrete log. Here's the setup, my attempt, and my code (producing the wrong 'r' value).
Let $p=10007$. $5$ is a primitive root. It can be shown that $L_5(2)=6578, L_5(3)=6190, L_5(7)=1301$. Use these facts to find $L_5(100)$
So, I have the fact that
$100\times5^r\equiv7\times3\times2\mod 10007$
$\implies L_5(100)\equiv-r+L_5(7)+L_5(3)+L_5(2)\mod 10006$
And $L_5(7)+L_5(3)+L_5(2)$ are known, so I now just need to find a $r$ s.t.
$100\times5^r\equiv7\times3\times2\equiv42\mod 10007$
So I wrote a program that basically just loops through $j$ for $0\leqslant j\lt p$, and then calculates $100*5^j\equiv ans \mod 10007$ and checks if $ans = 42$. When it is equal to 42, it prints the j used. This is producing an answer of $r=j=378$, however this is NOT correct, as $100\times5^{378}\not\equiv 42\mod 10007$. The correct answer is $r=j=911$.
Where have I gone wrong? Or else, is there an easier way to solve this problem? (Using Index-Calculus, I can solve it using Baby Step Giant Step, or Pohlig-Hellman algorithm.