Skip to content

DirichletCharacter ​

The jj-th Dirichlet character modulo kk evaluated at nn: a completely multiplicative, kk-periodic map χj:Z→C\chi_j: \mathbb{Z} \to \mathbb{C}, zero where gcd⁡(n,k)>1\gcd(n, k) > 1.

✓ checked against that system · ! checked, with disagreements (hover a chip)WikipediaDirichlet characterMathWorldDirichletCharacterWikidataQ1063579nLabDirichlet characterDLMF27.8.p1FungrimDirichletCharacter✓Fungrim entry4cf4e4d8c6d1✓fc4f6aWolfram LanguageDirichletCharacter!
DirichletCharacter(k, j, n)the character χj mod k\chi_j \bmod k at nn, for 1≤j≤φ(k)1 \le j \le \varphi(k); j=1j = 1 is the principal character.
Typed signatures
TypePackageApplies
(integer, integer, integer) -> numbercompute-enginealways

Domain: Special functions

Details
  • There are exactly φ(k)\varphi(k) characters mod kk — the dual group of (Z/k)×(\mathbb{Z}/k)^\times — and each is determined by its values on a set of generators. χ1\chi_1, the principal character, is 1 on the units and 0 elsewhere.
  • Every value is a root of unity of order dividing φ(k)\varphi(k), or 0: χj(mn)=χj(m)χj(n)\chi_j(mn) = \chi_j(m)\chi_j(n) always, and ∑n=1kχj(n)=0\sum_{n=1}^{k}\chi_j(n) = 0 for j≠1j \ne 1.
  • The indexing is Wolfram's DirichletCharacter[k,j,n]\mathrm{DirichletCharacter}[k, j, n], which no published formula pins down; it is reproduced here by decomposing (Z/k)×(\mathbb{Z}/k)^\times into one cyclic factor per prime power of kk in ascending prime order (an odd pep^e contributing its least primitive root, 2e2^e contributing ⟨−1⟩×⟨5⟩\langle -1\rangle \times \langle 5 \rangle) and reading j−1j - 1 as a mixed-radix exponent vector, first component most significant. The whole table is pinned against a Wolfram kernel for every modulus up to 40.
  • For a prime kk with primitive root gg this comes out as χj(g)=e2πi(j−1)/(k−1)\chi_j(g) = e^{2\pi i (j-1)/(k-1)}.
  • An out-of-range jj (greater than φ(k)\varphi(k)) names no character and is left unevaluated.
  • A modulus past 2532^{53} is left unevaluated too: the kernel works in machine integers.

Plot

Examples

1 more kept as data, checked against the oracles
Basic #

The nontrivial character mod 4: χ2(3)=−1\chi_2(3) = -1 (this is the one behind DirichletBeta)

live ↗
InDirichletCharacter(4,2,3)\mathrm{DirichletCharacter}(4, 2, 3)Out−1-1

χ2(2)=i\chi_2(2) = i mod 5 — 2 is a primitive root, so it takes the generating fourth root of unity

live ↗
InDirichletCharacter(5,2,2)\mathrm{DirichletCharacter}(5, 2, 2)Outii
Scope #

Values are roots of unity: 3 generates (Z/7)×(\mathbb{Z}/7)^\times, and χ3(3)=e2πi/3\chi_3(3) = e^{2\pi i/3}

live ↗
InDirichletCharacter(7,3,3)\mathrm{DirichletCharacter}(7, 3, 3)Oute23iπe^{\frac{2}{3}i π}

Listable in nn: the nontrivial character mod 3 over 1,…,51, \dots, 5

live ↗
InDirichletCharacter(3,2,[1,2,3,4,5])\mathrm{DirichletCharacter}(3, 2, \bigl\lbrack1, 2, 3, 4, 5\bigr\rbrack)Out[1,−1,0,1,−1]\bigl\lbrack1, -1, 0, 1, -1\bigr\rbrack
live ↗
InDirichletCharacter(20!,300,23)\mathrm{DirichletCharacter}(20!, 300, 23)OutDirichletCharacter(2 432 902 008 176 640 000,300,23)\mathrm{DirichletCharacter}(2\,432\,902\,008\,176\,640\,000, 300, 23)
Properties #

A character vanishes where gcd⁡(n,k)>1\gcd(n, k) > 1

live ↗
InDirichletCharacter(5,2,5)\mathrm{DirichletCharacter}(5, 2, 5)Out00

χ3\chi_3 mod 5 is the quadratic character: its period is 1,−1,−1,1,01, -1, -1, 1, 0, the Legendre symbol (n5)\left(\tfrac{n}{5}\right)

live ↗
InDirichletCharacter(5,3,2)\mathrm{DirichletCharacter}(5, 3, 2)Out−1-1

The trivial character mod 1 is 1 everywhere — its L-function is ζ\zeta

live ↗
InDirichletCharacter(1,1,7)\mathrm{DirichletCharacter}(1, 1, 7)Out11

Argument is reduced modulo the modulus

live ↗
InDirichletCharacter(7,3,20)\mathrm{DirichletCharacter}(7, 3, 20)Out11

Product of two character values left unsimplified

live ↗
InDirichletCharacter(7,3,4)DirichletCharacter(7,3,5)\mathrm{DirichletCharacter}(7, 3, 4)\mathrm{DirichletCharacter}(7, 3, 5)Out(−32i−12)(32i−12)(-\frac{\sqrt{3}}{2}i-\frac{1}{2})(\frac{\sqrt{3}}{2}i-\frac{1}{2})

Threads over a list, yielding a real character mod 12

live ↗
InDirichletCharacter(12,3,[1,5,7,11])\mathrm{DirichletCharacter}(12, 3, \bigl\lbrack1, 5, 7, 11\bigr\rbrack)Out[1,1,−1,−1]\bigl\lbrack1, 1, -1, -1\bigr\rbrack

A value with an exact complex root of unity

live ↗
InDirichletCharacter(45,8,7)\mathrm{DirichletCharacter}(45, 8, 7)Oute56iπe^{\frac{5}{6}i π}

A product of characters of different moduli, left unsimplified

live ↗
InDirichletCharacter(9,2,7)DirichletCharacter(5,4,2)\mathrm{DirichletCharacter}(9, 2, 7)\mathrm{DirichletCharacter}(5, 4, 2)Out−i(−32i−12)-i(-\frac{\sqrt{3}}{2}i-\frac{1}{2})
Possible issues #

jj must be at most φ(k)=4\varphi(k) = 4; out of range names no character and stays unevaluated

live ↗
InDirichletCharacter(5,9,2)\mathrm{DirichletCharacter}(5, 9, 2)OutDirichletCharacter(5,9,2)\mathrm{DirichletCharacter}(5, 9, 2)
About
Examples15
Checked againstWolfram Language 14 agree1 differ
CrosswalkWikipediaMathWorldWikidatanLabDLMFFungrimFungrim entry ×3Wolfram Language

Implementation

primitive · kernela kernel — an algorithm over mutable state that would not be readable as a tree

nativeenginetypescriptpackages/ce-patches/src/compute-engine/numerics/dirichlet-l.ts

A discrete logarithm against the cyclic decomposition — an algorithm over mutable state, not a tree.

mappedexternalwolframpackages/oracle/src/mappings.ts

DirichletCharacter[k, j, n], same indexing. mpmath has no character indexing at all.

See also: DirichletL, DirichletBeta, DirichletEta, Zeta