File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 4
4
* License: CC0
5
5
* Source: own work
6
6
* Description: Returns the smallest $x > 0$ s.t. $a^x = b \pmod m$, or
7
- * $-1$ if no such $x$ exists. Note that Modlog (a,1,m) can be used to
7
+ * $-1$ if no such $x$ exists. modLog (a,1,m) can be used to
8
8
* calculate the order of $a$.
9
9
* Time: $O(\sqrt m)$
10
10
* Status: tested for all 0 <= a,x < 500 and 0 < m < 500.
21
21
* 1. b is divisible by p^x
22
22
* 2. b is divisible only by some p^y, 0<y<x
23
23
* 3. b is not divisible by p
24
- * The important thing to note is that in case 2, modLog(a,b,m) (if
25
- * it exists) cannot be > sqrt(m), (technically it cannot be >= log2(m)).
24
+ * The important thing to note is that in case 2, modLog(a,b,m) (if
25
+ * it exists) cannot be > sqrt(m), (technically it cannot be >= log2(m)).
26
26
* So once all exponenents of a that are <= sqrt(m) has been checked, you
27
27
* cannot have case 2. Case 2 is the only tricky case.
28
28
*
You can’t perform that action at this time.
0 commit comments