NORDER

This function returns the multiplicative order of a modulo n, defined as the smallest positive integer k such that a^k \equiv 1 \pmod n.

Formally:

\operatorname{ord}_n(a) = \min\{k \in \mathbb{N} : a^k \equiv 1 \pmod n\}

The order exists when \gcd(a,n)=1 and is central to cyclic subgroup structure in modular arithmetic.

Excel Usage

=NORDER(a, n)
  • a (int, required): Base integer in the modular multiplicative group.
  • n (int, required): Modulus greater than one.

Returns (int): Smallest positive exponent yielding 1 modulo n.

Example 1: Multiplicative order of three modulo seven

Inputs:

a n
3 7

Excel formula:

=NORDER(3, 7)

Expected output:

6

Example 2: Multiplicative order of four modulo seven

Inputs:

a n
4 7

Excel formula:

=NORDER(4, 7)

Expected output:

3

Example 3: Multiplicative order in composite modulus

Inputs:

a n
2 9

Excel formula:

=NORDER(2, 9)

Expected output:

6

Example 4: Multiplicative order with larger modulus

Inputs:

a n
10 21

Excel formula:

=NORDER(10, 21)

Expected output:

6

Python Code

from sympy import n_order as sympy_n_order

def norder(a, n):
    """
    Find the multiplicative order of an integer modulo n.

    See: https://docs.sympy.org/latest/modules/ntheory.html#sympy.ntheory.residue_ntheory.n_order

    This example function is provided as-is without any representation of accuracy.

    Args:
        a (int): Base integer in the modular multiplicative group.
        n (int): Modulus greater than one.

    Returns:
        int: Smallest positive exponent yielding 1 modulo n.
    """
    try:
        return int(sympy_n_order(a, n))
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

Base integer in the modular multiplicative group.
Modulus greater than one.