login
A006586
a(n) = Sum_{k=1..n} floor((2n-1)/(2k+1)).
(Formerly M0988)
0
1, 2, 4, 6, 8, 10, 14, 15, 18, 22, 24, 27, 31, 33, 37, 40, 44, 47, 51, 53, 57, 63, 65, 68, 73, 75, 81, 85, 87, 91, 97, 100, 104, 108, 112, 115, 121, 125, 129, 134, 136, 142, 146, 148, 156, 160, 164, 166, 173, 176, 180, 188, 190, 194, 200, 202, 208, 214, 218, 223, 227
OFFSET
2,2
COMMENTS
"Nearest integer to" rounds down rather than up when given an exact half-integer.
Can also be described as sum_{k=1..n-1} { nearest integer to (n-k)/k }. - Jackson Xier, Oct 04 2011
REFERENCES
Marc LeBrun, personal communication.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
FORMULA
Clearly a(n) = n log n + O(n); a better estimate is surely possible.
EXAMPLE
Row sums of the triangle with entries floor((2n-1)/(2k+1)):
0;
1,0;
1,1,0;
2,1,1,0;
3,1,1,1,0;
3,2,1,1,1,0;
4,2,1,1,1,1,0;
5,3,2,1,1,1,1,0;
5,3,2,1,1,1,1,1,0;
6,3,2,2,1,1,1,1,1,0;
7,4,3,2,1,1,1,1,1,1,0;
MAPLE
N:=proc(x) local t1; t1:=floor(x); if x-t1 = 1/2 then t1 else floor(x+1/2); fi; end;
f:=n->add(N((n-k)/k), k=1..n-1);
[seq(f(n), n=1..120)];
MATHEMATICA
Sum[Floor[(-1 + 2 n)/(1 + 2 k)], {k, 1, n}] (* Jackson Xier, Oct 04 2011 *)
PROG
(PARI) a(n)=sum(k=1, n, (2*n-1)\(2*k+1)) \\ Charles R Greathouse IV, Oct 04 2011
CROSSREFS
Sequence in context: A253241 A337972 A302979 * A260391 A022292 A225241
KEYWORD
nonn,easy
EXTENSIONS
More terms from Gareth McCaughan, Jun 10 2004
Maple code from N. J. A. Sloane, Oct 02 2011
STATUS
approved