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!)
A271860 a(n) = -Sum_{i=1..n} (-1)^floor(n/i). 4
0, 1, 0, 3, 0, 3, 2, 5, 0, 5, 4, 7, 2, 5, 4, 11, 4, 7, 6, 9, 4, 11, 10, 13, 4, 9, 8, 15, 10, 13, 12, 15, 6, 13, 12, 19, 12, 15, 14, 21, 12, 15, 14, 17, 12, 23, 22, 25, 12, 17, 16, 23, 18, 21, 20, 27, 18, 25, 24, 27, 18, 21, 20, 31, 20, 27, 26, 29, 24, 31, 30 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
LINKS
FORMULA
a(2n) = 2*A075989(n) for n>0.
a(n) mod 2 = A000035(n).
a(n) = Sum_{k=1..n} (-1)^floor((n-k)/k). - Wesley Ivan Hurt, May 09 2021
G.f.: (1/(1 - x)) * Sum_{k>=1} x^k * (1 - x^k)/(1 + x^k). - Seiichi Manyama, Jun 06 2021
MAPLE
A271860:=n->-add((-1)^floor(n/i), i=1..n): seq(A271860(n), n=0..100);
MATHEMATICA
Table[-Sum[(-1)^Floor[n/i], {i, n}], {n, 0, 100}]
PROG
(PARI) a(n) = -sum(i=1, n, (-1)^(n\i)); \\ Michel Marcus, Apr 16 2016
(PARI) my(N=99, x='x+O('x^N)); concat(0, Vec(sum(k=1, N, x^k*(1-x^k)/(1+x^k))/(1-x))) \\ Seiichi Manyama, Jun 06 2021
(Python)
from math import isqrt
def A271860(n): return (((t:=isqrt(m:=n>>1))**2<<1)-(s:=isqrt(n))**2+(sum(n//k for k in range(1, s+1))-(sum(m//k for k in range(1, t+1))<<1)<<1)<<1)-n # Chai Wah Wu, Oct 23 2023
CROSSREFS
Column k=1 of A345033.
Sequence in context: A246924 A274715 A324180 * A219428 A016035 A340090
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Apr 15 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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 6 03:51 EDT 2024. Contains 375702 sequences. (Running on oeis4.)