Find the discrete logarithm Task
Write a program/function that when given 3 positive integers \$a, b\$ and \$m\$ as input outputs a positive integer \$x\$ such that \$a^x\equiv b\ (\text{mod}\ m)\$ or that no such \$x\$ exists.
A reference implementation can be found here.
Constraints
You can expect \$a\$ and \$b\$ to be less than \$m\$.
Scoring
This is code-golf so shortest bytes wins.
Sample Testcases
# a, b, m -&gt; x

10, 10, 50 -&gt; 1
10, 100, 200 -&gt; 2
10, 1, 127 -&gt; 42
35, 541, 1438 -&gt; 83
35, 541, 1438 -&gt; 1519
1816, 2629, 3077 -&gt; 223
3306, 4124, 5359 -&gt; 1923
346, 406, 430 -&gt; None
749430, 2427332, 2500918 -&gt; 8025683
3442727916, 3990620294, 6638635157 -&gt; 5731137125

Note: in the third testcase the solution cannot be 0 since the solution has to be a positive number
C (gcc), 59 53 51 bytes
Saved 6 bytes thanks to the man himself Arnauld!!!
Saved 2 bytes thanks Dominic van Essen!!!

p;x;f(a,b,m){for(p=a,x=1;p-b&amp;&amp;++x&lt;m;)p=p*a%m;x%=m;}

Try it online!
Inputs positive integers \$a,b,m\$ with \$a,b&lt;m\$.
Outputs a positive integer \$x\$ such that \$a^x\equiv b\ (\text{mod}\ m)\$ or \$0\$ if no such \$x\$ exists.