Skip to main content
1 of 3

How many pairs of numbers between 0 and n-1 are equal to z mod n?

I want to know how to compute this function:

$f : \mathbb{Z}_m \rightarrow \mathbb{N}$

$f(z) = |\{ (x, y) \in \mathbb{Z}_m^2 \mid \langle x, y\rangle = z \}|$

where $\langle x, y\rangle = \sum_{i \in [m]}x_iy_i$.