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
Antti Karttunen, Table of n, a(n) for n = 1..5000
EXAMPLE
In the array at A259575, row 6 is (1,3,6,8,11,15,16,18,...), with differences (2,3,2,3,4,1,2,...), and distinct differences {1,2,3,4}, so that a(4) = 4.
MATHEMATICA
x = 1; s[m_, n_] := Sum[Floor[(n*k + x)/m], {k, 0, m - 1}];
t[m_] := Table[s[m, n], {n, 1, 1000}];
u = Table[Length[Union[Differences[t[m]]]], {m, 1, 120}] (* A259576 *)
PROG
(PARI)
A259575sq(m, n) = sum(k=0, m-1, (1+(n*k))\m);
A259576(n) = #Set(vector(n, k, A259575sq(n, 1+k)-A259575sq(n, k))); \\ Antti Karttunen, Mar 02 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Jul 01 2015
STATUS
approved