login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


a(n) = Sum_{k=0..n} (-1)^k*floor(sqrt(k)).
4

%I #38 Jan 25 2024 04:28:01

%S 0,-1,0,-1,1,-1,1,-1,1,-2,1,-2,1,-2,1,-2,2,-2,2,-2,2,-2,2,-2,2,-3,2,

%T -3,2,-3,2,-3,2,-3,2,-3,3,-3,3,-3,3,-3,3,-3,3,-3,3,-3,3,-4,3,-4,3,-4,

%U 3,-4,3,-4,3,-4,3,-4,3,-4,4,-4,4,-4,4,-4,4,-4,4,-4,4,-4,4,-4,4,-4,4

%N a(n) = Sum_{k=0..n} (-1)^k*floor(sqrt(k)).

%H Andrew Howroyd, <a href="/A268173/b268173.txt">Table of n, a(n) for n = 0..1000</a>

%F a(n) = floor(sqrt(n))*(-1)^n/2 - ((-1)^(floor(sqrt(n))+1)+1)/4.

%F a(n) = (-1)^n * Sum_{i=1..ceiling(n/2)} c(n+2-2*i), where c is the square characteristic (A010052). - _Wesley Ivan Hurt_, Nov 26 2020

%F From _Ridouane Oudra_, Jan 21 2024: (Start)

%F a(n) = (-1)^n*floor((sqrt(n) + (n mod 2))/2);

%F a(2*n) = floor(sqrt(n/2));

%F a(2*n+1) = -floor(sqrt((n+1)/2) + 1/2). (End)

%e a(5) = -1 = floor(sqrt(0)) - floor(sqrt(1)) + floor(sqrt(2)) - floor(sqrt(3)) + floor(sqrt(4)) - floor(sqrt(5)).

%p seq(add((-1)^k*floor(sqrt(k)), k=0..n), n=0..80); # _Ridouane Oudra_, Jan 21 2024

%t Table[Sum[(-1)^k Floor[Sqrt@ k], {k, 0, n}], {n, 0, 50}] (* _Michael De Vlieger_, Mar 15 2016 *)

%o (PARI) a(n) = sum(k=0, n, (-1)^k*sqrtint(k)); \\ _Michel Marcus_, Jan 28 2016

%o (PARI) a(n) = sqrtint(n)*(-1)^n/2-((-1)^(sqrtint(n)+1)+1)/4; \\ _John M. Campbell_, Mar 15 2016

%Y Cf. A022554, A031876, A032512, A032513, A032514, A032515, A032516, A032517, A032518, A032519, A032520, A032521.

%K sign,easy

%O 0,10

%A _John M. Campbell_, Jan 28 2016

%E Terms a(55) and beyond from _Andrew Howroyd_, Mar 02 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 22 10:54 EDT 2024. Contains 376097 sequences. (Running on oeis4.)