login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A268173 Sum_{k=0..n} (-1)^k*floor(sqrt(k)). 3
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,10

LINKS

Table of n, a(n) for n=0..54.

FORMULA

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

EXAMPLE

a(5) = -1 = [sqrt(0)]-[sqrt(1)]+[sqrt(2)]-[sqrt(3)]+[sqrt(4)]-[sqrt(5)], letting [r] denote the floor function evaluated at a real number r.

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 A025824 A230037

Adjacent sequences:  A268170 A268171 A268172 * A268174 A268175 A268176

KEYWORD

sign,easy

AUTHOR

John M. Campbell, Jan 28 2016

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 October 22 06:54 EDT 2019. Contains 328315 sequences. (Running on oeis4.)