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

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A268173 a(n) = Sum_{k=0..n} (-1)^k*floor(sqrt(k)). 4
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, -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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,10
LINKS
FORMULA
a(n) = floor(sqrt(n))*(-1)^n/2 - ((-1)^(floor(sqrt(n))+1)+1)/4.
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
From Ridouane Oudra, Jan 21 2024: (Start)
a(n) = (-1)^n*floor((sqrt(n) + (n mod 2))/2);
a(2*n) = floor(sqrt(n/2));
a(2*n+1) = -floor(sqrt((n+1)/2) + 1/2). (End)
EXAMPLE
a(5) = -1 = floor(sqrt(0)) - floor(sqrt(1)) + floor(sqrt(2)) - floor(sqrt(3)) + floor(sqrt(4)) - floor(sqrt(5)).
MAPLE
seq(add((-1)^k*floor(sqrt(k)), k=0..n), n=0..80); # Ridouane Oudra, Jan 21 2024
MATHEMATICA
Table[Sum[(-1)^k Floor[Sqrt@ k], {k, 0, n}], {n, 0, 50}] (* Michael De Vlieger, Mar 15 2016 *)
PROG
(PARI) a(n) = sum(k=0, n, (-1)^k*sqrtint(k)); \\ Michel Marcus, Jan 28 2016
(PARI) a(n) = sqrtint(n)*(-1)^n/2-((-1)^(sqrtint(n)+1)+1)/4; \\ John M. Campbell, Mar 15 2016
CROSSREFS
Sequence in context: A033105 A106703 A127267 * A008617 A339369 A025824
KEYWORD
sign,easy
AUTHOR
John M. Campbell, Jan 28 2016
EXTENSIONS
Terms a(55) and beyond from Andrew Howroyd, Mar 02 2020
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | 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 May 5 02:46 EDT 2024. Contains 372257 sequences. (Running on oeis4.)