login
a(n) = Sum_{k=1..n} floor((2n-1)/(2k+1)).
(Formerly M0988)
0

%I M0988 #40 Sep 02 2024 01:20:40

%S 1,2,4,6,8,10,14,15,18,22,24,27,31,33,37,40,44,47,51,53,57,63,65,68,

%T 73,75,81,85,87,91,97,100,104,108,112,115,121,125,129,134,136,142,146,

%U 148,156,160,164,166,173,176,180,188,190,194,200,202,208,214,218,223,227

%N a(n) = Sum_{k=1..n} floor((2n-1)/(2k+1)).

%C "Nearest integer to" rounds down rather than up when given an exact half-integer.

%C Can also be described as sum_{k=1..n-1} { nearest integer to (n-k)/k }. - Jackson Xier, Oct 04 2011

%D _Marc LeBrun_, personal communication.

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%H M. Le Brun, <a href="/A006577/a006577.pdf">Email to N. J. A. Sloane, Jul 1991</a>

%F Clearly a(n) = n log n + O(n); a better estimate is surely possible.

%e Row sums of the triangle with entries floor((2n-1)/(2k+1)):

%e 0;

%e 1,0;

%e 1,1,0;

%e 2,1,1,0;

%e 3,1,1,1,0;

%e 3,2,1,1,1,0;

%e 4,2,1,1,1,1,0;

%e 5,3,2,1,1,1,1,0;

%e 5,3,2,1,1,1,1,1,0;

%e 6,3,2,2,1,1,1,1,1,0;

%e 7,4,3,2,1,1,1,1,1,1,0;

%p N:=proc(x) local t1; t1:=floor(x); if x-t1 = 1/2 then t1 else floor(x+1/2); fi; end;

%p f:=n->add(N((n-k)/k),k=1..n-1);

%p [seq(f(n),n=1..120)];

%t Sum[Floor[(-1 + 2 n)/(1 + 2 k)], {k, 1, n}] (* _Jackson Xier_, Oct 04 2011 *)

%o (PARI) a(n)=sum(k=1,n,(2*n-1)\(2*k+1)) \\ _Charles R Greathouse IV_, Oct 04 2011

%K nonn,easy

%O 2,2

%A _N. J. A. Sloane_

%E More terms from _Gareth McCaughan_, Jun 10 2004

%E Maple code from _N. J. A. Sloane_, Oct 02 2011