Multiplicative Order Calculator

Modular arithmetic

Multiplicative order of 2 modulo 1110
Euler totient phi(11)10
Is 2 a primitive root modulo 11?Yes
Check: 2 raised to the order, mod 111
How this was calculated
  1. The multiplicative order of a modulo n is the smallest positive exponent k with a^k congruent to 1 (mod n); it exists exactly when a and n are coprime.
  2. Euler's theorem bounds the search: the order always divides phi(11) = 10.
  3. Raising 2 to successive powers modulo 11, the value 1 first appears at exponent 10.
  4. An element is a primitive root when its order equals phi(n); here that is the case.

The multiplicative order of a modulo n is the smallest positive k for which a^k is congruent to 1 modulo n, and it is defined only when a and n are coprime. This multiplicative order calculator takes your values of a and n and returns that smallest k, along with the checks that make the result meaningful. For example, the multiplicative order of 2 modulo 11 is 10, which equals Euler's totient phi(11) = 10, so 2 is a primitive root modulo 11. The order of 2 modulo 7 is 3, while phi(7) = 6, so 2 is not a primitive root modulo 7; worked by hand the powers run 2, 4, 1. Likewise, the order of 4 modulo 9 is 3, while phi(9) = 6, so 4 is not a primitive root modulo 9.

The method behind the answer is the standard one for this calculation: by Euler's theorem the order of a always divides phi(n), and an element whose order equals phi(n) exactly is called a primitive root modulo n. Working from that divisor relationship is the accepted way to pin down the smallest exponent rather than testing powers blindly. This page shows the formula, the step-by-step workings, worked examples and sources so you can follow each stage and check the result yourself.

Worked examples

Order of 2 modulo 11 - a primitive root

(2 · 11)

Multiplicative order of 2 modulo 1110
Euler totient phi(11)10
Is 2 a primitive root modulo 11?Yes
Check: 2 raised to the order, mod 111

Order of 2 modulo 7

(2 · 7)

Multiplicative order of 2 modulo 73
Euler totient phi(7)6
Is 2 a primitive root modulo 7?No
Check: 2 raised to the order, mod 71

Order of 4 modulo 9

(4 · 9)

Multiplicative order of 4 modulo 93
Euler totient phi(9)6
Is 4 a primitive root modulo 9?No
Check: 4 raised to the order, mod 91

What the multiplicative order is

The multiplicative order of a modulo n is the smallest positive whole number k such that a^k is congruent to 1 modulo n. In plain terms, you raise a to higher and higher powers, divide each result by n, and watch the remainders. The order is the first exponent at which the remainder comes back to 1. That single definition is what any multiplicative order calculator is built to compute, and it is the number you get back once the search for that first return to 1 is finished.

There is one condition that must hold before the question even makes sense: a and n have to be coprime, meaning they share no common factor other than 1. If they are not coprime, no positive power of a can ever be congruent to 1 modulo n, so the order is simply not defined. A careful calculator will check this first and refuse the input rather than return a meaningless answer.

Small examples make the idea concrete. The multiplicative order of 2 modulo 7 is 3, because the powers run 2, 4, 1: the third power is the first one that leaves a remainder of 1. Compare that with Euler's totient phi(7) = 6, and you can see the order is smaller than phi(7), so 2 is not a primitive root modulo 7. The multiplicative order of 4 modulo 9 is 3, while phi(9) = 6, so 4 is not a primitive root modulo 9 either. At the other extreme, the multiplicative order of 2 modulo 11 is 10, which equals phi(11) = 10, so 2 is a primitive root modulo 11.

These examples point to a general rule. By Euler's theorem, the order of a always divides phi(n). That divisibility is a useful check on any result: if a claimed order does not divide phi(n), something has gone wrong. An element whose order equals phi(n) exactly is called a primitive root modulo n, and those are the elements that generate every coprime residue through their powers. Elements with a smaller order generate only part of that set.

So the order answers a specific question: how long is the cycle of remainders before it returns to 1? It is always defined relative to a particular modulus, it exists only for coprime pairs, and it never exceeds phi(n). When you work a problem by hand, listing powers until the remainder hits 1 is the direct method; the definition above is exactly what you are carrying out.

  • The order is the smallest positive k with a^k congruent to 1 modulo n.
  • It is defined only when a and n are coprime.
  • By Euler's theorem, the order always divides phi(n).
  • An element whose order equals phi(n) exactly is a primitive root modulo n.
  • Examples: order of 2 mod 7 is 3; order of 4 mod 9 is 3; order of 2 mod 11 is 10.
Quick check: the order of a modulo n must divide phi(n). If a candidate answer does not divide phi(n), it cannot be the order.

Euler's theorem and the totient

Euler's theorem ties the multiplicative order directly to Euler's totient, written phi(n). The theorem states that if a and n are coprime, then a raised to the power phi(n) is congruent to 1 modulo n. The multiplicative order of a modulo n is the smallest positive k for which a^k is congruent to 1 modulo n, and it is defined only when a and n are coprime. Because the order is the smallest such exponent and phi(n) is one exponent that works, the order can never be larger than phi(n). More than that, the order must divide phi(n) exactly. A good multiplicative order calculator applies this rule, so the reported order is always a divisor of phi(n).

The totient phi(n) counts the integers from 1 to n that are coprime to n. For a prime p, every integer from 1 to p minus 1 is coprime to p, so phi(p) = p minus 1. That is why phi(11) = 10 and phi(7) = 6. For a prime power such as 9, the count is smaller than 8 because the multiples of 3 share a factor with 9, which gives phi(9) = 6.

The order of 2 modulo 11 is 10, which equals phi(11) = 10. When an element's order equals phi(n) exactly, that element is called a primitive root modulo n, so 2 is a primitive root modulo 11. Not every coprime element reaches the full totient, though. The order of 2 modulo 7 is 3, while phi(7) = 6. Worked by hand, the powers of 2 modulo 7 run 2, 4, 1: the first return to 1 comes at the third power, so the order is 3. Since 3 divides 6 but does not equal it, 2 is not a primitive root modulo 7. Likewise, the order of 4 modulo 9 is 3, while phi(9) = 6, so 4 is not a primitive root modulo 9.

These examples show both halves of the rule. In each case the order divides the totient: 10 divides 10, 3 divides 6, and 3 divides 6. The order equals the totient only for a primitive root, which is why 2 qualifies modulo 11 but not modulo 7, and why 4 does not qualify modulo 9. When you check a result from a multiplicative order calculator, confirm that the order divides phi(n) and that no smaller positive exponent returns 1. A result that fails either check is wrong.

  • phi(11) = 10, and the order of 2 modulo 11 is 10, so 2 is a primitive root modulo 11.
  • phi(7) = 6, and the order of 2 modulo 7 is 3 (powers: 2, 4, 1), so 2 is not a primitive root modulo 7.
  • phi(9) = 6, and the order of 4 modulo 9 is 3, so 4 is not a primitive root modulo 9.
  • By Euler's theorem, the order of a always divides phi(n); an element whose order equals phi(n) exactly is a primitive root modulo n.
Quick check: the order of a modulo n must divide phi(n). If a candidate order does not divide the totient, it cannot be correct.

Primitive roots

A primitive root modulo n is an element whose multiplicative order is exactly phi(n), Euler's totient of n. Because Euler's theorem guarantees that the order of any element coprime to n divides phi(n), phi(n) is the largest order an element can possibly have. Reaching that ceiling is what makes an element a primitive root: its powers run through every residue coprime to n before returning to 1. A multiplicative order calculator makes this comparison quick, since you only need the order of a and the value of phi(n) to decide the question.

The classic working example is 2 modulo 11. The multiplicative order of 2 modulo 11 is 10, which equals Euler's totient phi(11) = 10, so 2 is a primitive root modulo 11. Because the order hits phi(n) exactly, the powers of 2 cover all ten residues coprime to 11 before cycling back to 1. That is the defining behavior of a primitive root, and it is why such elements are useful for building complete cycles of residues.

Now contrast that with 2 modulo 7. The multiplicative order of 2 modulo 7 is 3, while phi(7) = 6, so 2 is not a primitive root modulo 7. Worked by hand the powers run 2, 4, 1 — three steps and the cycle closes, well short of the six residues coprime to 7. The order 3 divides phi(7) = 6, exactly as Euler's theorem requires, but it does not equal it, so 2 generates only part of the coprime residues rather than all of them.

The same test applies to any base and modulus. The multiplicative order of 4 modulo 9 is 3, while phi(9) = 6, so 4 is not a primitive root modulo 9. Again the order divides the totient without reaching it. The pattern is consistent: compute the order, compute phi(n), and compare. Equality means a primitive root; a smaller divisor means the element generates a proper subgroup of the coprime residues.

One practical note: a separate primitive root page typically only reports whether a given a generates everything — a yes-or-no answer. That is useful, but it hides the quantity that decides the answer. Seeing the actual order next to phi(n) shows why the verdict comes out the way it does, and it makes the dividing relationship from Euler's theorem visible rather than implied. When you use a multiplicative order calculator, read both numbers together: the order of a and phi(n). Their comparison is the whole story behind primitive roots.

Primitive root test: order of a = phi(n)? For 2 modulo 11, 10 = 10, so yes. For 2 modulo 7, 3 ≠ 6, so no.

Why orders matter

The order of an element is not just a bookkeeping number. In modular arithmetic it controls how a sequence of powers behaves, and that behavior is the foundation of several widely used cryptographic ideas. The multiplicative order of a modulo n is the smallest positive k with a^k congruent to 1 modulo n, and it is defined only when a and n are coprime. Once you know that smallest k, you know the entire repeating pattern of powers of a, because the powers cycle with period exactly k.

That cycling is what makes discrete logarithms meaningful. A discrete logarithm asks: given a base a and a value b, what exponent x satisfies a^x congruent to b modulo n? The answer is only well behaved when the powers of a run through a predictable cycle, and the length of that cycle is the order. If the order is small, the list of possible values a^x is short and can be searched quickly. If the order is large, the same search becomes far more expensive. In this sense the order measures how much work the discrete logarithm problem demands for a given base, which is why anyone choosing parameters for a discrete-log-based system cares about it. A multiplicative order calculator makes that first check quick: enter a and n, get the order, and see immediately how long the cycle is.

Diffie-Hellman key exchange relies on exactly this difficulty. Two parties agree on a modulus and a base, each picks a private exponent, and each sends the other a power of the base. An eavesdropper who could efficiently solve the discrete logarithm would recover the private exponents and the shared secret. The security therefore depends on working in a group where the relevant orders are large enough that the discrete logarithm is impractical. The order of the chosen base determines the size of the subgroup actually in use, so a base with a small order offers only a small space of possible values, no matter how large the modulus looks.

Euler's theorem ties the order to the modulus itself: the order of a always divides phi(n), and an element whose order equals phi(n) exactly is called a primitive root modulo n. Concrete cases show how much this matters. The multiplicative order of 2 modulo 11 is 10, which equals Euler's totient phi(11) = 10, so 2 is a primitive root modulo 11. By contrast, the multiplicative order of 2 modulo 7 is 3, while phi(7) = 6, so 2 is not a primitive root modulo 7; worked by hand the powers run 2, 4, 1. Likewise, the multiplicative order of 4 modulo 9 is 3, while phi(9) = 6, so 4 is not a primitive root modulo 9.

The practical lesson is that a large modulus alone does not guarantee a large cycle. Checking the order of the specific base you intend to use tells you whether you are getting the full range of values or only a small slice of it. That single check sits behind the discrete logarithm problem and, through it, behind Diffie-Hellman key exchange.

The order of a always divides phi(n). When the order equals phi(n) exactly, a is a primitive root modulo n — the case that gives the longest possible cycle.

FAQs

What is the multiplicative order of 2 modulo 11?

The multiplicative order of 2 modulo 11 is 10. This equals phi(11), which is 10, so 2 is a primitive root modulo 11. In other words, the powers of 2 modulo 11 cycle through every nonzero residue before returning to 1.

What is the multiplicative order of 2 modulo 7?

The multiplicative order of 2 modulo 7 is 3. The powers run 2, 4, 1: 2 to the first power is 2, 2 squared is 4, and 2 cubed is 8, which is 1 modulo 7. So the order is 3.

Is 2 a primitive root modulo 7?

No. The order of 2 modulo 7 is 3, while phi(7) = 6. A primitive root must have order equal to phi(n), so 2 is not a primitive root modulo 7. Its powers repeat after only 3 steps instead of covering all 6 nonzero residues.

What is the multiplicative order of 4 modulo 9?

The multiplicative order of 4 modulo 9 is 3, against phi(9) = 6. Since 3 does not equal 6, 4 is not a primitive root modulo 9. The powers of 4 modulo 9 return to 1 after three steps rather than cycling through all six units.

When is the multiplicative order defined?

The multiplicative order is defined only when a and n are coprime, meaning their greatest common divisor is 1. If a and n share a factor, the powers of a modulo n never return to 1, so no order exists. Check coprimality first before computing.

Must the order divide phi(n)?

Yes. By Euler's theorem the order always divides phi(n). For example, modulo 9, phi(9) = 6, and the order of 4 is 3, which divides 6. This divisibility is a useful check: any claimed order that does not divide phi(n) must be wrong.

Sources

Related calculators

Carmichael Function Calculator
The Carmichael function lambda(n), the smallest universal exponent modulo n, from the prime factorization, compared with Euler's totient.
Primitive Root Calculator
The smallest primitive root modulo a prime p, the count of primitive roots from Euler's totient, and the factorization of p - 1 that the test runs on.
Euler's Totient Calculator
Euler's totient φ(n) — how many integers up to n are coprime to n — from the distinct prime factors of n.