Order Mod Calculator

Compute modular order from valid inputs easily. Inspect residues, cycles, inverses, and primitive root potential. View graphs, export tables, and follow guided calculation steps.

Calculator Inputs

Enter any integer. The calculator reduces it modulo n.
Use n > 1. Order exists only when gcd(a, n) = 1.
Choose how many powers appear in the output table.
Plot the first k residues of ak mod n.

Example Data Table

Base a Modulus n gcd(a, n) ordn(a) Comment
2 5 1 4 2 generates all nonzero residues modulo 5.
2 7 1 3 The sequence 2, 4, 1 closes after three powers.
3 7 1 6 3 is a primitive root modulo 7.
2 9 1 6 The multiplicative cycle covers every unit modulo 9.
6 15 3 Not defined Order fails because the base is not coprime to the modulus.

Formula Used

The calculator finds the multiplicative order ordn(a), which is the smallest positive integer k satisfying ak ≡ 1 (mod n).

A valid order requires gcd(a, n) = 1. If the base and modulus are not coprime, the order does not exist.

The search is restricted to divisors of λ(n), the Carmichael function, because the order always divides λ(n).

Euler’s totient φ(n) counts numbers from 1 to n that are coprime to n. If ordn(a) = φ(n), then a is a primitive root modulo n.

How to Use This Calculator

  1. Enter the base a.
  2. Enter the modulus n, making sure it is greater than 1.
  3. Choose how many residue rows and graph points you want.
  4. Keep the divisor-check option enabled when you want a proof table.
  5. Press Calculate Order Mod to show the answer above the form.
  6. Review the order, inverse, totient values, graph, and residue cycle.
  7. Export the summary and residue data using the CSV or PDF buttons.

Frequently Asked Questions

1) What does order mod mean here?

It means the multiplicative order of a modulo n. The calculator finds the smallest positive exponent k for which ak leaves residue 1 after division by n.

2) Why must gcd(a, n) equal 1?

Only units in modular arithmetic can cycle back to 1 under multiplication. If a and n share a factor, repeated powers cannot belong to the multiplicative group modulo n.

3) Why does the calculator use λ(n)?

The multiplicative order always divides the Carmichael function λ(n). That makes the search shorter than testing every exponent one by one, especially for larger moduli.

4) What is the difference between φ(n) and λ(n)?

φ(n) counts the integers coprime to n, while λ(n) gives a universal exponent for the multiplicative group modulo n. The order of a divides both, but λ(n) is often smaller.

5) What does the primitive root message tell me?

If ordn(a) equals φ(n), the base generates every residue that is coprime to n. In that case, the base acts as a primitive root modulo n.

6) Can I enter negative values for the base?

Yes. The calculator first reduces the base into the standard residue class from 0 to n−1, then computes the order using that normalized value.

7) What do the graph and residue table show?

They show how the residues change as the exponent increases. Repetition in the plot and table helps you visualize the cycle length that defines the multiplicative order.

8) When should I use this calculator?

Use it for number theory practice, cryptography study, modular cycle analysis, primitive root exploration, or fast verification of worked homework and research examples.

Related Calculators

Modular Exponentiation Fast Power CalculatorReverse Euclidean algorithm calculatorfast modular exponentiation calculatorLarge number modulo calculatormodular congruence solverpisano period calculatoreuler totient calculatorgcd calculatorprime number checkercommon multiples calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.