Discrete logarithm calculator
The discrete logarithm problem is to find the exponent in the expression BaseExponent = Power (mod Modulus).
This applet works for both prime and composite moduli. The only restriction is that the base and the modulus, and the power and the modulus must be relatively prime.
In this version of the discrete logarithm calculator only the Pohlig-Hellman algorithm is implemented, so the execution time is proportional to the square root of the largest prime factor of the modulus minus 1. The applet works in a reasonable amount of time if this factor is less than 1017.
I will add the index-calculus algorithm soon. This algorithm has subexponential running time.
You can also enter expressions that use the following operators and parentheses:
- + for addition
- - for subtraction
- * for multiplication
- / for division
- % for remainder
- ^ or ** for exponentiation
- n!: factorial
- p#: primorial (product of all primes less or equal than p).
- B(n): Previous pseudoprime to n
- F(n): Fibonacci number Fn
- L(n): Lucas number Ln = Fn-1 + Fn+1
- N(n): Next pseudoprime to n
- P(n): Unrestricted Partition Number (number of decompositions of n into sums of integers without regard to order).
You can use the prefix 0x for hexadecimal numbers, for example 0x38 is equal to 56.
The exponentiation symbol is not present in some mobile devices, so two asterisks ** can by typed as the exponentiation operator.
Example: Find the number n such that 7n ≡ 23 (mod 43241).
Type 7 in the Base input box, 23 in the Power input box and 43241 in the Mod input box. Then press the button named "Discrete logarithm".
The result is 3360 + 3930 k. As a check you can compute 73360 ≡ 23 (mod 43241) and 73930 ≡ 1 (mod 43241).
Written by Dario Alpern. Last updated 31 July 2016.
If you find any error or you have a comment, please fill in the form.