Dirichlet character
where formula_4   and  formula_5  is the Dirichlet character for the quadratic field. For "p" = 3 there is a factor (1 + "m") multiplying the LHS. Here