Find Order of a Number in Mathematica - Number Theory

  • Mathematica
  • Thread starter axeae
  • Start date
  • Tags
    Mathematica
In summary, the conversation discusses finding the order of a number in Mathematica, specifically the function MultiplicativeOrder[a,n]. It is mentioned that this function will crash if gcd(a,n)!=1, and it is clarified that the function actually finds the order of a number modulo n. It is also mentioned that if gcd(a,n)!=1, the function will return no output in Mathematica 6.
  • #1
axeae
70
0
does anyone know how to find the order of a number in mathematica? all a google search turns up is ordering numbers :rofl:

thanks

whoops, this should be in number theory

and for those who were wondering, its MultiplicativeOrder[a,n]
 
Last edited:
Physics news on Phys.org
  • #2
I don't understand. Isn't MultiplicativeOrder[a,n] precisely the thing you want? And you aren't finding the order of a number. You're finding the order of a number modulo n. A number does not have an order.
 
  • #3
Just be careful how you use that function. If gcd(a,n)!=1 then it will crash.
 
  • #4
Why will it crash? Surely it verifies that a and n are coprime first (which is a trivial calculation).
 
  • #5
yeah sorry for the confusion, I posted this and then realized it was in the wrong section and then finally found the command.

btw if gcd(a,n)!=1, it just returns no output in Mathematica 6

edit: yeah I misspoke, I should have said order of a number mod n, in my example a was the number and n was the mod.
 

What is the purpose of finding the order of a number in Mathematica?

The order of a number in Mathematica is used to determine the smallest positive integer n such that a^n is congruent to 1 (mod m), where a and m are positive integers. This concept is important in number theory and has various applications in cryptography and other fields.

How do I find the order of a number in Mathematica?

To find the order of a number in Mathematica, you can use the Order function. This function takes in two arguments: the base number and the modulus. For example, if you want to find the order of 3 in mod 7, you would use Order[3,7]. The function will return the smallest positive integer n such that 3^n is congruent to 1 (mod 7).

Can the order of a number be calculated for any base and modulus in Mathematica?

Yes, the Order function can be used for any positive integers a and m. However, if the base and modulus are not relatively prime, the function will return an error. This is because the concept of order is only defined for relatively prime numbers.

What is the time complexity of the Order function in Mathematica?

The time complexity of the Order function in Mathematica is O(log(m)), where m is the modulus. This means that the time it takes to find the order of a number will increase logarithmically as the modulus increases.

Are there any other functions in Mathematica that can be used to find the order of a number?

Yes, there are other functions that can also be used to find the order of a number in Mathematica, such as EulerPhi and CarmichaelLambda. These functions have different definitions and can be useful in certain scenarios. It is recommended to consult the Mathematica documentation for more information on these functions.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
20
Views
7K
  • Science and Math Textbooks
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top