If is an arbitrary integer relatively prime to and is a primitive root of , then there exists among the numbers 0, 1, 2, ..., , where is the totient function, exactly one number such that
The number is then called the discrete logarithm of with respect to the base modulo and is denoted
The term "discrete logarithm" is most commonly used in cryptography, although the term "generalized multiplicative order" is sometimes used as well (Schneier 1996, p. 501). In number theory, the term "index" is generally used instead (Gauss 1801; Nagell 1951, p. 112).
For example, the number 7 is a positive primitive root of (in fact, the set of primitive roots of 41 is given by 6, 7, 11, 12, 13, 15, 17, 19, 22, 24, 26, 28, 29, 30, 34, 35), and since , the number 15 has multiplicative order 3 with respect to base 7 (modulo 41) (Nagell 1951, p. 112). The generalized multiplicative order is implemented in the Wolfram Language as MultiplicativeOrder[g, n, a1], or more generally as MultiplicativeOrder[g, n, a1, a2, ...].
Discrete logarithms were mentioned by Charlie the math genius in the Season 2 episode "In Plain Sight" of the television crime drama NUMB3RS.