login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons 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

Andrew Howroyd, Table of n, a(n) for n = 0..1000

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

EXAMPLE

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

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

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

Sequence in context: A033105 A106703 A127267 * A008617 A339369 A025824

Adjacent sequences:  A268170 A268171 A268172 * A268174 A268175 A268176

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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 24 21:35 EST 2021. Contains 341584 sequences. (Running on oeis4.)