DirichletCharacter[k,j,n]
gives the Dirichlet character
with modulus k and index j.
DirichletCharacter
DirichletCharacter[k,j,n]
gives the Dirichlet character
with modulus k and index j.
Details
- 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.
Examples
open all close allBasic Examples (2)
Table[DirichletCharacter[2, 1, n], {n, 10}]Table[DirichletCharacter[7, j, n], {j, 1, EulerPhi[7]}, {n, 0, 6}]//GridTable[DiscretePlot[{Re[DirichletCharacter[7, j, n]], Im[DirichletCharacter[7, j, n]]}, {n, 0, 20}, PlotLabel -> j], {j, 1, 6}]Scope (3)
DirichletCharacter[20!, 300, 23]Compute the Dirichlet transform:
DirichletTransform[DirichletCharacter[3, 2, n], n, s]DirichletCharacter threads element-wise over lists:
DirichletCharacter[3, 2, {1, 2, 3, 4, 5}]Applications (5)
Compute the number of primitive Dirichlet characters modulo
:
q[k_] := With[{r = Cases[#, {p_, 1} :> p], s = Cases[#, {p_, d_} /; d ≥ 2 :> p]}, k Product[1 - 2 / p, {p, r}]Product[(1 - 1 / p) ^ 2, {p, s}]] & @ FactorInteger[k]Table[q[k], {k, 2, 10}]DiscretePlot[q[k], {k, 2, 50}]Define generalized Bernoulli numbers from DirichletCharacter:
GeneralizedBernoulliB[k_, j_, n_Integer] :=
n! SeriesCoefficient[Series[Sum[DirichletCharacter[k, j, i]t Exp[i * t] / (Exp[k * t] - 1), {i, k - 1}], {t, 0, n + 1}], n]Table[GeneralizedBernoulliB[5, 3, k], {k, 0, 10}]Compute values at negative integers of DirichletL using generalized Bernoulli numbers:
SpecialDirichletL[k_, j_, n_Integer ? Negative] := -GeneralizedBernoulliB[k, j, 1 - n] / (1 - n)Table[SpecialDirichletL[5, 3, k], {k, -10, -1}]Table[DirichletL[5, 3, k], {k, -10, -1}]The generalized Bernoulli number at 0 of a principal character is
and zero otherwise:
Table[GeneralizedBernoulliB[5, j, 0], {j, 4}]Dirichlet characters modulo
form a group:
G[k_] := Table[DirichletCharacter[k, j, n], {j, EulerPhi[k]}]add[DirichletCharacter[k_, j1_, n_], DirichletCharacter[k_, j2_, n_]] := DirichletCharacter[k, Mod[j1 + j2, EulerPhi[k], 1], n]e[k_] := DirichletCharacter[k, EulerPhi[k], n]inv[DirichletCharacter[k_, j_, n_]] := DirichletCharacter[k, Mod[EulerPhi[k] - j, EulerPhi[k], 1], n]Operations on Dirichlet characters:
f = DirichletCharacter[5, 2, n];
g = DirichletCharacter[5, 3, n];add[f, g]{add[f, e[5]], add[e[5], g]}{inv[f], inv[g]}Overscript[χ, ^ ][k_, j_, r_ : 1] := Sum[DirichletCharacter[k, j, i] * Exp[2Pi I r i / k], {i, 1, k - 1}]Overscript[χ, ^ ][7, 4]The product of
and its character modulo
at values coprime to
gives Gauss sums:
Table[DirichletCharacter[7, 4, n]Overscript[χ, ^ ][7, 4, n] == Overscript[χ, ^ ][7, 4], {n, 1, 6}]For primitive characters modulo
,
are zero at values not coprime to
:
Table[Overscript[χ, ^ ][7, 4, 7n], {n, 5}]For primitive characters modulo
, absolute values of Gauss sums are equal to
:
FullSimplify[Abs[Overscript[χ, ^ ][7, 4]] == Sqrt[7]]Find conductors of Dirichlet characters modulo
with
an odd prime power:
conductor[k_ , j_] :=
Select[{#, EulerPhi[#] * (j - 1) / EulerPhi[k] + 1} & /@ Divisors[k], (IntegerQ[Last[#]] && Last[#] ≠ 1 && Last[#] ≠ j)&, 1]DirichletCharacter[25,11,n] has a conductor 5:
conductor[25, 11]coprimes = Pick[Range[25], CoprimeQ[Range[25], 25]];Table[DirichletCharacter[25, 11, n] == DirichletCharacter[5, 3, n], {n, coprimes}]Properties & Relations (11)
DirichletCharacter is periodic:
Table[DirichletCharacter[7, 3, n] == DirichletCharacter[7, 3, 7 + n], {n, 7}]DirichletCharacter is completely multiplicative:
DirichletCharacter[7, 3, 4 5]DirichletCharacter[7, 3, 4]DirichletCharacter[7, 3, 5]Values of Dirichlet characters are equal to zero or roots of unity:
Table[DirichletCharacter[7, 5, n], {n, 0, 4}]Abs[%]DirichletCharacter modulo
is nonzero at values coprime to
:
Table[DirichletCharacter[7, 3, n], {n, 1, 6}]DirichletCharacter modulo
is zero at values not coprime to
:
Table[DirichletCharacter[7, 3, 7n], {n, 1, 6}]The trivial character takes the value
for all integers:
Table[DirichletCharacter[1, 1, n], {n, -5, 5}]A principal character modulo
has index
and gives
for values coprime to
; otherwise it gives
:
Table[DirichletCharacter[5, 1, n], {n, EulerPhi[5]}]Table[DirichletCharacter[9, 1, n], {n, EulerPhi[9]}]Real Dirichlet characters modulo
have index
or
:
Table[DirichletCharacter[k, 1, n], {k, 3, 10}, {n, 0, k - 1}]Table[DirichletCharacter[k, EulerPhi[k] / 2 + 1, n], {k, 3, 10}, {n, 0, k - 1}]JacobiSymbol[n,k] is a real Dirichlet character modulo k for odd integers k:
Table[JacobiSymbol[n, 5], {n, 0, 4}]Table[DirichletCharacter[5, 3, n], {n, 0, 4}]A real primitive character χ modulo k can be defined as JacobiSymbol[χ[-1]k,n]:
Table[DirichletCharacter[7, 4, n], {n, 0, 6}]Table[JacobiSymbol[DirichletCharacter[7, 4, -1] * 7, n], {n, 0, 6}]Nonprimitive real characters can be written in terms of JacobiSymbol at integers coprime to
:
DirichletCharacter[12, 3, {1, 5, 7, 11}]JacobiSymbol[-4, {1, 5, 7, 11}]DirichletCharacter[k,j,n] gives
at the primitive root n of k, when it exists:
PrimitiveRoot[7]Table[DirichletCharacter[7, j, 3], {j, EulerPhi[7]}]Use the multiplicative property of DirichletCharacter to get values at integers coprime to
:
Table[DirichletCharacter[7, 2, 3 ^ n] == DirichletCharacter[7, 2, 3] ^ n, {n, EulerPhi[7]}]A character modulo
can be written as a product of characters modulo prime powers of
:
DirichletCharacter[3^2 5, 8, 7]DirichletCharacter[3^2, 2, 7]DirichletCharacter[5, 4, 2]First find primitive roots of 32 and 5:
p1 = PrimitiveRoot[3^2]p2 = PrimitiveRoot[5]a1 = ChineseRemainder[{p1, 1}, {3^2, 5}]a2 = ChineseRemainder[{1, p2}, {3^2, 5}]Find exponents of 7 modulo 32 and 5:
e1 = MultiplicativeOrder[a1, 3^2, 7]e2 = MultiplicativeOrder[a2, 5, 7]Dirichlet characters are labeled in an increasing order of the number of factors:
j1 = 2;j2 = 4;(j1 - 1) * (EulerPhi[3^2] - 1) + (j2 - 1)Decomposition of the Dirichlet character modulo 32 5 with index 8:
DirichletCharacter[3^2, j1, a1 ^ e1]DirichletCharacter[5, j2, a2 ^ e2]Verify the decomposition formula for all integers coprime to 32 5:
coprimes = Pick[Range[3^2 5], CoprimeQ[Range[3^25], 3^25]];Table[DirichletCharacter[3^2, j1, a1 ^ MultiplicativeOrder[a1, 3^2, n]]DirichletCharacter[5, j2, a2 ^ MultiplicativeOrder[a2, 5, n]], {n, coprimes}]Table[DirichletCharacter[3^25, 8, n], {n, coprimes}]% == %%Lift a Dirichlet character modulo 3 to a Dirichlet character modulo a power of 3:
Table[DirichletCharacter[3, 2, n], {n, {1, 2, 4, 7, 8, 11, 13, 14}}]index[μ_, k_, j_] := EulerPhi[μ](j - 1) / EulerPhi[k] + 1{index[3^3, 3, 2], index[3^4, 3, 2]}Table[DirichletCharacter[3^3, 10, n], {n, {1, 2, 4, 7, 8, 11, 13, 14}}]Table[DirichletCharacter[3^4, 28, n], {n, {1, 2, 4, 7, 8, 11, 13, 14}}]See Also
Related Guides
History
Text
Wolfram Research (2008), DirichletCharacter, Wolfram Language function, https://reference.wolfram.com/language/ref/DirichletCharacter.html.
CMS
Wolfram Language. 2008. "DirichletCharacter." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DirichletCharacter.html.
APA
Wolfram Language. (2008). DirichletCharacter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DirichletCharacter.html
BibTeX
@misc{reference.wolfram_2026_dirichletcharacter, author="Wolfram Research", title="{DirichletCharacter}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/DirichletCharacter.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_dirichletcharacter, organization={Wolfram Research}, title={DirichletCharacter}, year={2008}, url={https://reference.wolfram.com/language/ref/DirichletCharacter.html}, note=[Accessed: 12-June-2026]}