FLINT3.7.0-dev

dirichlet_group_init

Synopsis#include <flint/dirichlet.h>
int dirichlet_group_init(dirichlet_group_t G, ulong q)source

Initialises G as the group of characters modulo q \ge 1, computing the factorisation of q, the Conrey generators and the exponent. No discrete logarithm tables are computed, so this is cheap even for large q. Returns 1 on success, and 0 (without allocating) if a prime factor of q exceeds 10^{16}, for which the generator is not implemented.

For an odd prime p the Conrey generator is the smallest positive integer that is a primitive root modulo p^2, hence modulo every p^e. It equals the smallest primitive root modulo p except for p = 40487 and p = 6692367337, the only such primes below 10^{16}. For q divisible by 8, the components for the 2-part are generated by -1 and 5; for 4 \| q by -1; for 2 \| q there is no component.

Guides#

Cite this page

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