Modular Log - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


NumberTheory

  

ModularLog

  

discrete logarithm under modular arithmetics

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

ModularLog(a, b, n, output = o, method = m)

Parameters

a

-

rational

b

-

integer

n

-

positive integer

output = o

-

(optional) keyword argument where o is a list of the names , ,

method = m

-

(optional) keyword argument where m is one of the names , ,

Description

• 

The ModularLog function computes the discrete logarithm of rationals under modular arithmetics. The base b discrete logarithm of a modulo n is a number  such that .

• 

If a is not an integer, then the denominator of a must be relatively prime to the modulus n.

• 

If the output option is not specified, then the return value is the smallest non-negative , if it exists. An error message is displayed if  does not exist.

• 

If the output option is specified, then the return value is a sequence obtained from output by replacing each instance of  with  and each instance of  or  with a number  such that for every non-negative integer ,  and  is minimal. Similarly, an error message is displayed if  does not exist.

• 

When the method option is not specified or set to , then the algorithm used is chosen automatically based on the size of the problem. Set method to  to force Shanks' Baby-Step Giant-Step algorithm. Set method to  to force the Index Calculus algorithm.

Examples

(1)

Since  does not have a base  logarithm modulo , an error message is displayed.

Error, (in NumberTheory:-ModularLog) no solutions exist

(2)

If  is set to  or greater, userinfo messages will be printed. The ModularLog function prints messages at levels  and .

(3)

ModularLog:   "using Shanks' method to compute log[25](1441) mod 10007"

(4)

ModularLog:   "using the index calculus method to compute log[5](1441) mod 10007"
ModularLog:   "found new equation 1 out of 4"
ModularLog:   "found new equation 2 out of 4"
ModularLog:   "found new equation 3 out of 4"
ModularLog:   "found new equation 4 out of 4"

(5)

(6)

Compatibility

• 

The NumberTheory[ModularLog] command was introduced in Maple 2016.

• 

For more information on Maple 2016 changes, see Updates in Maple 2016.

See Also

NumberTheory

NumberTheory[PrimitiveRoot]

 


Download Help Document