OFFSET
1,3
COMMENTS
More generally if r is irrational 1 < r < 2 then Sum_{i=1..n} floor(r*floor(i/r)) = n*(n+1)/2 - floor((1-1/r)*n); if r > 2, there is the asymptotic formula Sum_{i=1..n} floor(r*floor(i/r)) = n*(n+1)/2 - ceiling(r)*(1-floor(r)/(2*r))*n + O(1).
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..5000
FORMULA
a(n) = n*(n+1)/2 - floor((1-1/sqrt(2))*n).
MATHEMATICA
Table[Sum[Floor[Sqrt[2] Floor[k/Sqrt[2]]], {k, n}], {n, 50}] (* G. C. Greubel, Oct 01 2018 *)
PROG
(PARI) a(n) = sum(i=1, n, floor(sqrt(2)*floor(i/sqrt(2)))); \\ Michel Marcus, Dec 04 2013
(Magma) [(&+[Floor(Sqrt(2)*Floor(k/Sqrt(2))): k in [1..n]]): n in [1..50]]; // G. C. Greubel, Oct 01 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Jun 13 2003
STATUS
approved