Compute the number of primitive Dirichlet characters modulo
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

and zero otherwise:
Dirichlet characters modulo
k form a group:
Operations on Dirichlet characters:
For primitive characters modulo
k,

are zero at values not coprime to
k:
For primitive characters modulo
k, absolute values of Gauss sums are equal to

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