FLINT3.7.0-dev

fq_multiplicative_order

Synopsis#include <flint/fq.h>
int fq_multiplicative_order(fmpz * ord, const fq_t op, const fq_ctx_t ctx)

Computes the order of op in the multiplicative group, which divides q - 1, and stores it in ord unless ord is NULL. Returns 0 if op is zero (and sets the order to 0), 1 if op is a primitive element (its order is q - 1), and -1 otherwise.

The function factors q - 1 with fmpz_factor, which can take a long time for large q when q - 1 has large prime factors, and then removes prime factors from q - 1 as long as the power of op stays 1. This also tests whether a defining polynomial is primitive: its root fq_gen is primitive if and only if this function returns 1.

Cite this page

The FLINT team, “fq_multiplicative_order (fq.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fq/fq_multiplicative_order.html (generated 2026-10-20).