How many (reduced) quadratic forms represent a given prime?

74 Views Asked by At

For a given prime $p$, how many (reduced) quadratic forms represent it?

(inspired by this question)

Is it enough to just find quadratic residues of $p$ (as candidates for the discriminant) and count which ones are 0 or 1 modulo 4, or is it more involved (as in "class number" complicated)? And can the resulting number of forms be deduced from $p$ using more elementary means? Is it always finite? Does it have any asymptotic behavior?