Find Order of a Number in Mathematica - Number Theory

  • Topic: Mathematica 
  • Thread starter Thread starter axeae
  • Start date Start date
  • Tags Tags
    Mathematica
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
4 replies · 3K views
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.