Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Let $p$ be a prime, and let $x\bmod p$ denote the least positive residue of $x$ modulo $p$. For $a \in \{1,2,...,p−1\}$, set $$f(a)=\sum^{p−1}_{g=1} g \times (ag \bmod p).$$
Is it true that $f(a)=f(b)$ if and only if $a=b$ or $a=b^{−1}$ mod $p$? Can we determine $f(a) \bmod p^2$?
$\begingroup$I am afraid that this question is not appropriate for this site - please read the FAQ. You might have better luck at math.stackexchange.com, but you should read the FAQ there also, in particular the comments about homework.$\endgroup$
$\begingroup$Why was this closed? The notation is hard to read, but it seems he's asking about the residue mod $p^2$ (not mod $p$) of $\sum_{g=0}^{p-1} g [ag]$ where $[\cdot]$ is the least residue mod $p$, and that question looks nontrivial (though it may reduce to known identities for Dedekind sums).$\endgroup$
$\begingroup$@Noam: Why do MO questions ever get closed? It's hard to read, not motivated at all, and appears to be homework that the OP is not even attempting to make palatable to MO users. Whether the mathematical question behind it is good or not becomes irrelevant at this point.$\endgroup$
$\begingroup$Thanks to G.Myerson for the pointer to the math.se question. Since one cannot post a new answer to a closed question, I answered there and report here: numerically it seems $f(a)/p \equiv (a+a^{-1})/12 \bmod p$, which would imply the desired criterion for $f(a) \equiv f(b) \bmod p^2$.$\endgroup$