dirichlet.hCharacters in the Conrey numbering
A Dirichlet character modulo is a homomorphism , extended to by for . There are characters, forming a group isomorphic to , but the isomorphism is not canonical: naming the characters requires a choice. This module uses the choice of Conrey, adopted by the LMFDB [LMFDB], which is reviewed here; the mathematics is described in Dirichlet characters.
Numbers and logs#
dirichlet_group_init decomposes into cyclic components, one for each odd prime power and up to two for the power of 2, and fixes a generator of order for each: for odd, the smallest primitive root modulo ; for , the elements (if ) and (if ). Every is then
where is the generator lifted to (congruent to modulo the prime power and to 1 modulo the rest of ). The integer is the number and the vector the log. A dirichlet_char_t stores both. Going from the log to the number is a product of powers (_dirichlet_char_exp); going from the number to the log needs discrete logarithms (dirichlet_char_log).
The character with number is
where and are the logs of and . This pairing is symmetric in and , and the map is an isomorphism, so the structure of a character can be read from its number: its order is the order of modulo , and it is real if . The character is principal.
Values as exponents#
All values of the characters modulo are powers of , where = G->expo is the exponent of the group (the least common multiple of the ). The functions return the exponent of , which is exact, or the special value DIRICHLET_CHI_NULL for . The _order variants of the vector functions take another modulus for the exponents, any multiple of the order of : with the order itself, the exponents are the smallest possible. Complex values are obtained with acb_dirichlet, for example from a table of the powers of .
A single value dirichlet_chi(G, chi, n) costs a discrete logarithm of in each component. For many values use dirichlet_chi_vec, which either enumerates the whole group once or sieves the discrete logarithms of all from those of the primes, or precompute tables with dirichlet_group_dlog_precompute.
Example#
The program prints all characters modulo 15 in the order of dirichlet_char_next, with their logs, conductors, parities, orders and the exponents of their values at (a dot for 0). The group exponent is 4, so the exponent stands for : the character has . The components are the group modulo 3, generated by (), and modulo 5, generated by (). Three characters, those with conductor 15, are primitive, and the character of number 4, the Legendre symbol modulo 5, has conductor 5.
#include <flint/flint.h>
#include <flint/dirichlet.h>
int main(void)
{
dirichlet_group_t G;
dirichlet_char_t chi;
ulong v[15];
slong k;
dirichlet_group_init(G, 15);
dirichlet_char_init(chi, G);
flint_printf("%wu characters, exponent %wu, %wu primitive\n",
dirichlet_group_size(G), G->expo, dirichlet_group_num_primitive(G));
dirichlet_char_one(chi, G);
do
{
flint_printf("m = %2wu log ", chi->n);
dirichlet_char_print(G, chi);
flint_printf(" cond %2wu %s order %wu ",
dirichlet_conductor_char(G, chi),
dirichlet_parity_char(G, chi) ? "odd " : "even",
dirichlet_order_char(G, chi));
dirichlet_chi_vec(v, G, chi, 15);
for (k = 1; k < 15; k++)
{
if (v[k] == DIRICHLET_CHI_NULL)
flint_printf(" .");
else
flint_printf(" %wu", v[k]);
}
flint_printf("\n");
}
while (dirichlet_char_next(chi, G) >= 0);
dirichlet_char_clear(chi);
dirichlet_group_clear(G);
return 0;
}8 characters, exponent 4, 3 primitive m = 1 log [0, 0] cond 1 even order 1 0 0 . 0 . . 0 0 . . 0 . 0 0 m = 7 log [0, 1] cond 5 odd order 4 0 1 . 2 . . 1 3 . . 0 . 3 2 m = 4 log [0, 2] cond 5 even order 2 0 2 . 0 . . 2 2 . . 0 . 2 0 m = 13 log [0, 3] cond 5 odd order 4 0 3 . 2 . . 3 1 . . 0 . 1 2 m = 11 log [1, 0] cond 3 odd order 2 0 2 . 0 . . 0 2 . . 2 . 0 2 m = 2 log [1, 1] cond 15 even order 4 0 3 . 2 . . 1 1 . . 2 . 3 0 m = 14 log [1, 2] cond 15 odd order 2 0 0 . 0 . . 2 0 . . 2 . 2 2 m = 8 log [1, 3] cond 15 even order 4 0 1 . 2 . . 3 3 . . 2 . 1 0
The table illustrates the symmetry of the pairing: the exponent in row and column equals the one in row and column , for instance .
References#
- [LMFDB] The LMFDB Collaboration, The L-functions and modular forms database, https://www.lmfdb.org (Dirichlet characters: https://www.lmfdb.org/Character/Dirichlet/).
The FLINT team, “Characters in the Conrey numbering (dirichlet.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/dirichlet/conrey.html (generated 2026-11-02).
@misc{flint-doc-dirichlet-conrey,
author = {{The FLINT team}},
title = {{Characters in the Conrey numbering (dirichlet.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/dirichlet/conrey.html},
note = {Generated 2026-11-02}
}