Mathematica Find Order of a Number in Mathematica - Number Theory

  • Thread starter Thread starter axeae
  • Start date Start date
  • Tags Tags
    Mathematica
AI Thread Summary
The discussion centers on finding the order of a number in Mathematica, specifically the command MultiplicativeOrder[a,n]. It clarifies that this function determines the order of a number modulo n, not the order of the number itself. The conversation highlights a potential issue: if the greatest common divisor (gcd) of a and n is not equal to 1, the function may not return an output, particularly in Mathematica version 6. Participants acknowledge the initial confusion regarding terminology and the appropriate context for using the function.
axeae
Messages
70
Reaction score
0
does anyone know how to find the order of a number in mathematica? all a google search turns up is ordering numbers :smile:

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
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.
 
Just be careful how you use that function. If gcd(a,n)!=1 then it will crash.
 
Why will it crash? Surely it verifies that a and n are coprime first (which is a trivial calculation).
 
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.
 

Similar threads

Replies
1
Views
2K
Replies
6
Views
5K
Replies
5
Views
3K
Replies
20
Views
7K
Replies
2
Views
2K
Replies
1
Views
2K
Back
Top