def count_modp_solutions__by_Gauss_sum(self, p, m): """ Return the number of solutions of `Q(x) = m (mod p)` of a non-degenerate quadratic form over the finite field `Z/pZ`, where `p` is a prime number > 2. .. NOTE:: We adopt the useful convention that a zero-dimensional quadratic form has exactly one solution always (i.e. the empty vector). These are defined in Table 1 on p363 of Hanke's "Local Densities..." paper. INPUT: - `p` -- a prime number > 2 - `m` -- an integer OUTPUT: an integer >= 0 EXAMPLES:: sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1]) sage: [Q.count_modp_solutions__by_Gauss_sum(3, m) for m in range(3)] [9, 6, 12] sage: Q = DiagonalQuadraticForm(ZZ, [1,1,2]) sage: [Q.count_modp_solutions__by_Gauss_sum(3, m) for m in range(3)] [9, 12, 6] """ if self.dim() == 0: return 1 return count_modp__by_gauss_sum(self.dim(), p, m, self.Gram_det())
def count_modp_solutions__by_Gauss_sum(self, p, m): """ Returns the number of solutions of `Q(x) = m (mod p)` of a non-degenerate quadratic form over the finite field `Z/pZ`, where `p` is a prime number > 2. Note: We adopt the useful convention that a zero-dimensional quadratic form has exactly one solution always (i.e. the empty vector). These are defined in Table 1 on p363 of Hanke's "Local Densities..." paper. INPUT: `p` -- a prime number > 2 `m` -- an integer OUTPUT: an integer >= 0 EXAMPLES:: sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1]) sage: [Q.count_modp_solutions__by_Gauss_sum(3, m) for m in range(3)] [9, 6, 12] :: sage: Q = DiagonalQuadraticForm(ZZ, [1,1,2]) sage: [Q.count_modp_solutions__by_Gauss_sum(3, m) for m in range(3)] [9, 12, 6] """ if self.dim() == 0: return 1 else: return count_modp__by_gauss_sum(self.dim(), p, m, self.Gram_det())