Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Order (mathematica)

  1. Jul 1, 2007 #1
    does anyone know how to find the order of a number in mathematica? all a google search turns up is ordering numbers :rofl:


    whoops, this should be in number theory

    and for those who were wondering, its MultiplicativeOrder[a,n]
    Last edited: Jul 1, 2007
  2. jcsd
  3. Jul 1, 2007 #2

    matt grime

    User Avatar
    Science Advisor
    Homework Helper

    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.
  4. Jul 1, 2007 #3
    Just be careful how you use that function. If gcd(a,n)!=1 then it will crash.
  5. Jul 1, 2007 #4

    matt grime

    User Avatar
    Science Advisor
    Homework Helper

    Why will it crash? Surely it verifies that a and n are coprime first (which is a trivial calculation).
  6. Jul 1, 2007 #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.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?