2

I have the summation: $$F(n) := \sum_{i=1}^n \lfloor i\sqrt2 \rfloor $$ (i.e. $F(5) = 19$)

I would like to simplify the expression of $F$ and get rid of the sum. I saw the proof that $\sum_{i=1}^n i = \frac{n(n+1)}{2}$ via $$S(n) = 1 + 2 + \ldots + n-1 + n$$ $$S(n) = n + n-1 + \ldots + 2 + 1$$ $$2S(n) = (n+1) + (n+1) + \ldots + (n+1) + (n+1)$$ $$S(n) = \frac{n(n+1)}{2}$$

And I tried to copy it for my own use, $$F(n) = \lfloor\sqrt2\rfloor + \lfloor2\sqrt2\rfloor + ... + \lfloor(n-1)\sqrt2\rfloor + \lfloor n\sqrt2\rfloor$$

$$F(n) = \lfloor n\sqrt2\rfloor + \lfloor (n-1)\sqrt2\rfloor + ... + \lfloor 2\sqrt2\rfloor + \lfloor\sqrt2\rfloor$$

$$2F(n) = (\lfloor n\sqrt2\rfloor + \lfloor \sqrt2\rfloor) + (\lfloor n\sqrt2\rfloor + \lfloor \sqrt2\rfloor) + ... + (\lfloor n\sqrt2\rfloor + \lfloor \sqrt2\rfloor) + (\lfloor n\sqrt2\rfloor + \lfloor \sqrt2\rfloor)$$

$$F(n) = n\frac{\lfloor n\sqrt2\rfloor + \lfloor \sqrt2\rfloor}{2}$$

However, $F(5)$ gives me $20$, not the correct $19$.
My only thought was that it's an issue with separate $floor$ functions interacting with each other, but I am not sure.

Can anyone explain to me where I went wrong, and/or point me in the correct direction for finding this equation?

RobPratt
  • 45,619
Aharon K
  • 121
  • 1
    You are trying to apply the formula for the sum of an arithmetic progression to something that isn't an arithmetic progression. That's essentially hopeless. – saulspatz Jan 18 '21 at 18:28
  • 1
    Floors don't add by an easy formula. e.g. can't say floor(a+b)=floor(a)+floor(b). – coffeemath Jan 18 '21 at 18:28
  • 1
    To add to @saulspatz 's point, $\lfloor 2 \sqrt{2} \rfloor + \lfloor (n - 1) \sqrt{2} \rfloor \ne \lfloor n \sqrt{2} \rfloor + \lfloor \sqrt{2} \rfloor$. – ViktorStein Jan 18 '21 at 18:29
  • Due to irrationality, the difference $\lfloor\sqrt2(i+1)\rfloor-\lfloor\sqrt2i\rfloor$ is $0$ or $1$ in a pseudo-random way ($41%$ of $1$'s). I don't know of a way to express it shortly. –  Jan 18 '21 at 20:45
  • @YvesDaoust the pattern is, I believe, {1,1,2,1,2} (https://oeis.org/A006337). Does that help? – Aharon K Jan 18 '21 at 20:48
  • No, this is the pattern for $1.4$. There is no pattern for $\sqrt2$. (Sorry for the typo above, I meant $\lfloor\sqrt 2(i+1)\rfloor-\lfloor\sqrt 2i\rfloor-1$). –  Jan 18 '21 at 20:52

0 Answers0