Group Theory Order Calculator screenshot

Group Theory Order Calculator

Compute the multiplicative order of an element modulo n, list the subgroup it generates, and name every generator of the unit group.

Privacy First
0 Runs
Updated 2026-11-22
Runs in your browser
No sign-up, no upload
Exact modular arithmetic

Group Theory Order Calculator

Compute the multiplicative order of an element modulo n, list the subgroup it generates, and name every generator of the unit group.

How this page computes

φ(n) is counted by a gcd pass, then factorised. For each prime factor q of φ(n), the exponent φ(n)/q is tested by fast modular exponentiation and divided out while it still gives 1.

The subgroup is walked from 1 by repeated multiplication, collecting values until one repeats. The final checks confirm a^order = 1 and that the order divides φ(n).

The calculation runs entirely in this browser tab; nothing is uploaded.

The multiplicative order of a modulo n is the smallest positive k with a^k ≡ 1. For 3 modulo 7 it is 6, so 3 generates the whole unit group; for 2 modulo 7 it is 3, so 2 generates only the subgroup {1, 2, 4}.

The order always divides φ(n), so the page factors φ(n) and divides it out rather than testing every exponent. It also walks the subgroup the element generates, so the printed cycle is the real one and not a restatement of the order.

How to use Group Theory Order Calculator

Type the element and the modulus, then press Run. The element must be coprime with the modulus; otherwise it has no multiplicative order and the page names the shared factor instead of a number.

The output gives φ(n), the order, whether the element is a generator, the subgroup it generates, and the list of every generator of the whole group.

Why factoring φ(n) is enough

Lagrange's theorem says the order divides φ(n). So the order is φ(n) divided by some product of its prime factors. For each prime factor q of φ(n), the page tests whether a^(φ(n)/q) is already 1; if it is, that factor can be removed. Removing every removable factor leaves the exact order.

The subgroup is produced by multiplying by a repeatedly until the value returns to 1, which is a walk around the cycle the element generates. Its length is the order, so the two computations check each other.

What to Expect

Best for

  • The multiplicative order of a residue
  • Deciding whether an element generates the unit group
  • Seeing the subgroup an element generates

Not ideal for

  • An element that shares a factor with the modulus, which is not in the group
  • Orders in a general group given by a presentation
  • A modulus above one hundred thousand

What this tool keeps

  • The element and the modulus exactly

What may need cleanup

  • Nothing: the order is exact

Common errors

  • A non-coprime element is refused with the gcd named
  • A modulus below 2 is refused
  • An element congruent to 0 modulo n is refused

Example use cases

  • Find the order of 3 modulo 7
  • See that 2 is not a generator modulo 7
  • List the generators of the group modulo 7

Sample input

a = 3, n = 7

Sample output

order 6, a generator, subgroup 1, 3, 2, 6, 4, 5

Who this is for

  • Students meeting cyclic groups
  • Readers checking a primitive root

Frequently asked questions

Why must a be coprime with n?

Because the multiplicative group modulo n contains exactly the residues coprime with n. A residue with a shared factor cannot reach 1 by multiplication, so no order exists and the page says so.

What is a generator?

An element whose order equals the whole group's order, so its powers reach every unit. Modulo 7 the generators are 3 and 5, and 2 is not one because its order is 3.

Why is the order a divisor of phi(n)?

That is Lagrange's theorem: the subgroup an element generates has as many elements as its order, and a subgroup's size divides the group's. The page uses that fact instead of searching blindly.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.