OFFSET
1,2
COMMENTS
The "reciprocity law" that Sum{[(n*k+x)/m] : k = 0..m} = Sum{[(m*k+x)/n] : k = 0..n} where x is a real number and m and n are positive integers, is proved in Section 3.5 of Concrete Mathematics (see References). See A259572 for a guide to related sequences.
REFERENCES
R. L. Graham, D. E. Knuth, O. Patashnik, Concrete Mathematics, Addison-Wesley, 1989, pages 90-94.
LINKS
Clark Kimberling, Table of n, a(n) for n = 1..500
FORMULA
a(n) = sum{sum{floor((n*k + x)/m), k=0..m-1, m=1..n}, where x = 1.
a(n) = n^3 / 4 + O(n^2). - Charles R Greathouse IV, Mar 22 2017
MATHEMATICA
f[n_] := Sum[Floor[(n*k + 1)/m], {m, n}, {k, 0, m - 1}]; Array[f, 50]
PROG
(PARI) a(n)=x=1; r=0; for(m=1, n, for(k=0, m-1, r=r+floor((n*k+x)/m))); return(r);
main(size)=return(vector(size, n, a(n))) \\ Anders Hellström, Jul 06 2015
(PARI) a(n)=sum(m=1, n, sum(k=0, m-1, (n*k+1)\m)) \\ Charles R Greathouse IV, Mar 22 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Jul 01 2015
STATUS
approved