Multiplicative Order

Author

Eric W. Weisstein
May 19, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/NumberTheory/MultiplicativeOrder.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/MultiplicativeOrder.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Code

Brute force

ModuloOrder[a_,m_]:=Module[{k=1},
While[PowerMod[a,k,m]≠1,k++];
k
]

Usage

?MultiplicativeOrder

Examples

MultiplicativeOrder[2,7]

ModuloOrder[2,7]

Table[PowerMod[2,k,7],{k,3}]

MultiplicativeOrder[7,41,{15}]

Table[MultiplicativeOrder[2,13,{k}],{k,12}]

Table[MultiplicativeOrder[3,17,{k}],{k,16}]

Table[MultiplicativeOrder[2,19,{k}],{k,18}]

Golomb

Something's wrong here

MultiplicativeOrder[2,7]

MultiplicativeOrder[2,2 7+1]