13

Let $n \in \mathbb {N^*}$ and $$S_n = \sum_{k=1}^{n-1} (k^2 \bmod n)$$

with the first values 0, 1, 2, 2, 10, 13, 14, 12, 24, 45, 44, 38, 78, 77, 70, 56, 136, 129, 152, 130, 182, 209, 184, 148, 250, 325, 288, 294, 406, 365, 372, 304, 484, 561, 490, 402, 666, 665, 572, 540, 820, 805, 860, 726, 840, 897, 846, 680, 980, 1125

​​and it appears that $$S_n\leq \frac {n(n-1)}2$$

We can show that $$S_n\leq \frac {n(n-1)}2\iff \sum _{i=1}^{n-1}\left\lfloor \frac{i^2}{n}\right\rfloor \ge \frac{\left(n-1\right)\left(n-2\right)}3$$ we have equality if $n$ is prime and $n \equiv 1 \mod 4$

Do you think this inequality is true?

Addition :

We fix a prime number $p$ that satisfies $p \equiv 1 \pmod{4}$. Let $\forall n \in \mathbb{N}^*$, $S_n$ be defined as the sum from $k = 0$ to $p^n - 1$ of $(k^2)_{p^n}$. Numerically, it appears that $2S_n = p^n(p^n - p^{\lfloor n/2 \rfloor})$. If we can prove this equality, we can deduce inequality (the object of the thread) in many cases

RobPratt
  • 50,938
Paul
  • 3,864
  • 1
    This is sequence $A048153$ in $OEIS$ – Claude Leibovici Mar 07 '23 at 13:51
  • 1
    The crudest lower bound results in: $$S_n \geq \dfrac{(n-1)(2n-1)}{6} - (n-1) = \dfrac{(n-1)(n-2)}{3} - \dfrac{n-1}{2},$$ so I would guess this is possible to do with some more care. – dezdichado Mar 07 '23 at 14:59
  • 2
    Related (but maybe kind of sophisticated): search "sum of quadratic residues". E.g. this question gives an exact formula for $n$ a prime of the form $p \equiv 3 \pmod{4}$. – Jakob Streipel Mar 10 '23 at 14:48
  • 1
    I also asked the question on https://mathoverflow.net/questions/442497/conjecture-sum-i-1n-1-lfloor-fraci2n-rfloor-ge-frac-leftn-1-r – Paul Mar 11 '23 at 11:41
  • Your last remark seems to hold more generally (just an observation): If $n=2\prod p_i^{e_i}$ or $n=\prod p_i^{e_i}$ where $p_i \equiv 1 \pmod 4$, then $S_n=\frac{1}{2}n(n-\prod p_i^{\lfloor e_i/2 \rfloor})$. – Sil Mar 11 '23 at 19:55
  • I don't know if this is useful, but I managed to prove that the sum on the question is the same as $$ n(n-1) -\sum\limits_{k=1}^{n-1} \lceil \sqrt{k \cdot n} \rceil$$. From here, you can prove that this is $\geq \dfrac{n^2}{3}-2n+1$. It seems a little bit off what is wanted. – Arthur Queiroz Moura Mar 12 '23 at 20:48
  • @Arthur Queiroz Moura It is proven for $n=1+4k$ that $\sum_{i=1}^{k}\left\lfloor \sqrt{in}\right\rfloor =2\left( \frac{n-1} {4}\right) ^{2}-\sum_{x=1}^{\left( n-1\right) /2}\left\lfloor \frac{x^{2} }{n}\right\rfloor $ in this link https://artofproblemsolving.com/community/c146t416f146h150713_i_12 . So, I am curious to see how you prove your equality without conditions on n – Paul Mar 12 '23 at 22:51
  • @Pascal For each $k \in {1, \dots n-1 }$ you count how many $i \in {1, \dots n-1 }$ are such that $ \left \lfloor \dfrac{i^2}{n} \right \rfloor = k$. In particular, this is true if and only if $$ \left \lfloor \dfrac{i^2}{n} \right \rfloor = k \Longleftrightarrow k \cdot n \leq i^2 < (k+1) \cdot n \Longleftrightarrow \sqrt{k \cdot n} \leq i < \sqrt{(k+1) \cdot n}$$ And the number of integers in this interval is $(\lceil \sqrt{(k+1) \cdot n} \rceil - 1)-(\lceil \sqrt{k \cdot n} \rceil) + 1 = \lceil \sqrt{(k+1) \cdot n} \rceil - \lceil \sqrt{k \cdot n} \rceil$. So you sum $k$ times – Arthur Queiroz Moura Mar 12 '23 at 23:20
  • You'll get $$ \sum\limits_{k=1}^{n-1} k \cdot (\lceil \sqrt{(k+1) \cdot n} \rceil - \lceil \sqrt{k \cdot n} \rceil) $$ which can be simplified to the desired result – Arthur Queiroz Moura Mar 12 '23 at 23:21
  • 1
    Here there is an idea although it doesn't quite work so probably nothing, wikipedia say that $\sum_{k=1}^{n-1}{km/n}=(n-1)/2$ where ${x}=x-\lfloor x\rfloor$ is the fractional part, suppose that with some luck something similar holds for $\sum{k^2m/n}\leq(n-1)/2$ so if we set $k=i$ and $m=1$ we get $\sum{i^2/n}\leq (n-1)/2$, then $\sum_{i=1}^{n-1} \lfloor i^2/n\rfloor=\sum_{i=1}^{n-1} i^2/n-\sum{i^2/n}\geq (n-1)(2n-1)/6-(n-1)/2=(n-1)(2n-1-3)/6=(n-1)(n-2)/3$ – Dabed Mar 15 '23 at 03:50
  • This inequality is equivalent to $S_n \leq \frac{n(n-1)}{2}$, where $S_n = \sum_{k=1}^{n-1} (k^2 \bmod n)$. The equality holds when $n$ is prime and $n \equiv 1 \pmod{4}$. It appears that the equality $2S_n = p^n(p^n - p^{\lfloor n/2 \rfloor})$ holds for all $n \in \mathbb{N}^*$ when $p \equiv 1 \pmod{4}$. – Yatharth Shrivastava Mar 17 '23 at 11:27

1 Answers1

2

Now, that the bounty period is gone, I am posting this incomplete answer, containing a collection of known results ... nothing new (thus, not deserving any bounty, imo).


From division with remainder $$n\left\lfloor \frac{i^2}{n}\right\rfloor+r_i=i^2, 0\le r_i<n \tag{1}$$ Then $$\sum _{i=1}^{n-1}\left\lfloor \frac{i^2}{n}\right\rfloor= \sum _{i=1}^{n-1} \frac{i^2}{n} - \sum _{i=1}^{n-1}\frac{r_i}{n}= \frac{(n-1)(2n-1)}{6}- \sum _{i=1}^{n-1}\frac{r_i}{n} \tag{2}$$


Remark 1. We have: $$\frac{(n-1)(2n-1)}{6} - \frac{n-1}{2}=\frac{(n-1)(n-2)}{3}$$ What is left to show is: $$\sum _{i=1}^{n-1}\frac{r_i}{n} \le \frac{n-1}{2}= \sum _{i=1}^{n-1}\frac{i}{n}$$ Or $$\sum _{i=1}^{n-1} r_i \le \sum _{i=1}^{n-1} i \tag{3}$$


Remark 2. We have $\forall i\le \frac{n}{2}$ $$r_{i}=r_{n-i}$$

Indeed, from: $$n\left\lfloor \frac{(n-i)^2}{n}\right\rfloor+r_{n-i}=(n-i)^2 \iff\\ n\left\lfloor n-2i+\frac{i^2}{n}\right\rfloor+r_{n-i}=n^2 -2in +i^2\iff\\ n\left\lfloor \frac{i^2}{n}\right\rfloor+r_{n-i}=i^2$$ and the result follows from $(1)$.


Remark 3. Every $r_i$ is a quadratic residue modulo $n$. One interesting sum is: $$T(n)=\sum_{i=1}^{n-1}i \cdot\chi_{n}(i)\tag{4}$$ which "goes over" quadratic residues and non-residues modulo $n$, where $$\chi_{n}(m)={\begin{cases}\;\;\,0&{\text{ if }}n{\text{ divides }}m\\ +1&{\text{ if }}m\text{ is quadratic residue modulo }n{\text{ and }}n{\text{ does not divide }}m\\ -1&{\text{ if }}m\text{ is not quadratic residue modulo } n{\text{ and }}n{\text{ does not divide }}m\end{cases}}$$ If $n$ is a prime, then $\chi_{n}(m)\equiv\left(\frac{m}{n}\right)$ - Legendre symbol. Then, pointing at the Dirichlet's formulas

  • if $n \equiv 3 \pmod{4}$ then $T(n) < 0$
  • if $n \equiv 1 \pmod{4}$ then $T(n) = 0$

Now, a summary for the case when $n$ is a prime number, from Remark 3:

  • if $n \equiv 3 \pmod{4}$ then $$T(n) < 0 \iff \sum_{i=1 \text{ & }\\ \chi_n(i)=1}^{n-1}i < \sum_{i=1 \text{ & }\\ \chi_n(i)=-1}^{n-1}i\iff\\ 2\left( \sum_{i=1 \text{ & }\\ \chi_n(i)=1}^{n-1}i\right) < \sum_{i=1 \text{ & }\\ \chi_n(i)=1}^{n-1}i +\sum_{i=1 \text{ & }\\ \chi_n(i)=-1}^{n-1}i\tag{5a}$$
  • if $n \equiv 1 \pmod{4}$ then $$T(n) = 0 \iff \sum_{i=1 \text{ & }\\ \chi_n(i)=1}^{n-1}i = \sum_{i=1 \text{ & }\\ \chi_n(i)=-1}^{n-1}i\iff\\ 2\left( \sum_{i=1 \text{ & }\\ \chi_n(i)=1}^{n-1}i\right) = \sum_{i=1 \text{ & }\\ \chi_n(i)=1}^{n-1}i +\sum_{i=1 \text{ & }\\ \chi_n(i)=-1}^{n-1}i\tag{5b}$$

However $$\sum_{i=1 \text{ & }\\ \chi_n(i)=1}^{n-1}i +\sum_{i=1 \text{ & }\\ \chi_n(i)=-1}^{n-1}i=\sum_{i=1}^{n-1}i$$ Also, because $n$ is prime, thus odd, and considering Remark 2 $$\sum _{i=1}^{n-1} r_i=2\left( \sum_{i=1 \text{ & }\\ \chi_n(i)=1}^{n-1}i\right)$$

Looking at $5(a)$, $(5b)$ and $(3)$, this proves the result for $n$ - prime.

rtybase
  • 17,398