gives the Dirichlet character with modulus k and index j.


  • Integer mathematical function, suitable for both symbolic and numerical manipulation.
  • DirichletCharacter[k,j,n] picks a particular ordering for possible Dirichlet characters modulo k.
  • There are ϕ distinct Dirichlet characters for a given modulus k, as labeled by the index j. Different conventions can give different orderings for the possible characters.
  • DirichletCharacter[k,j,n] is periodic in n with period k.
  • DirichletCharacter[k,j,n] is zero when n is not coprime to k.
  • DirichletCharacter[k,j,n] is a multiplicative function in n.


open allclose all

Basic Examples  (2)

A basic Dirichlet character:

All the modulo 7 characters:

Plot them:

Scope  (3)

Evaluate for large arguments:

Compute the Dirichlet transform:

DirichletCharacter threads element-wise over lists:

Applications  (5)

Compute the number of primitive Dirichlet characters modulo :

Plot of q[k]:

Define generalized Bernoulli numbers from DirichletCharacter:

Compute values at negative integers of DirichletL using generalized Bernoulli numbers:

The generalized Bernoulli number at 0 of a principal character is (TemplateBox[{k}, EulerPhi])/k and zero otherwise:

Dirichlet characters modulo form a group:


Zero element:


Operations on Dirichlet characters:

Gauss sums:

The product of and its character modulo at values coprime to gives Gauss sums:

For primitive characters modulo , are zero at values not coprime to :

For primitive characters modulo , absolute values of Gauss sums are equal to :

Find conductors of Dirichlet characters modulo with an odd prime power:

DirichletCharacter[25,11,n] has a conductor 5:


Properties & Relations  (11)

DirichletCharacter is periodic:

DirichletCharacter is completely multiplicative:

Values of Dirichlet characters are equal to zero or roots of unity:

DirichletCharacter modulo is nonzero at values coprime to :

DirichletCharacter modulo is zero at values not coprime to :

The trivial character takes the value for all integers:

A principal character modulo has index and gives for values coprime to ; otherwise it gives :

Real Dirichlet characters modulo have index or :

JacobiSymbol[n,k] is a real Dirichlet character modulo k for odd integers k:

A real primitive character χ modulo k can be defined as JacobiSymbol[χ[-1]k,n]:

Nonprimitive real characters can be written in terms of JacobiSymbol at integers coprime to :

DirichletCharacter[k,j,n] gives exp((2 pi ⅈ (j-1))/(TemplateBox[{k}, EulerPhi])) at the primitive root n of k, when it exists:

Use the multiplicative property of DirichletCharacter to get values at integers coprime to :

A character modulo can be written as a product of characters modulo prime powers of :

First find primitive roots of 32 and 5:

Lift the primitive roots:

Find exponents of 7 modulo 32 and 5:

Dirichlet characters are labeled in an increasing order of the number of factors:

Decomposition of the Dirichlet character modulo 32 5 with index 8:

Verify the decomposition formula for all integers coprime to 32 5:

Lift a Dirichlet character modulo 3 to a Dirichlet character modulo a power of 3:

Compute the index:


Wolfram Research (2008), DirichletCharacter, Wolfram Language function, https://reference.wolfram.com/language/ref/DirichletCharacter.html.


Wolfram Research (2008), DirichletCharacter, Wolfram Language function, https://reference.wolfram.com/language/ref/DirichletCharacter.html.


Wolfram Language. 2008. "DirichletCharacter." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DirichletCharacter.html.


Wolfram Language. (2008). DirichletCharacter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DirichletCharacter.html


@misc{reference.wolfram_2023_dirichletcharacter, author="Wolfram Research", title="{DirichletCharacter}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/DirichletCharacter.html}", note=[Accessed: 12-April-2024 ]}


@online{reference.wolfram_2023_dirichletcharacter, organization={Wolfram Research}, title={DirichletCharacter}, year={2008}, url={https://reference.wolfram.com/language/ref/DirichletCharacter.html}, note=[Accessed: 12-April-2024 ]}