OFFSET
0,4
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..10000
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
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
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Apr 15 2016
STATUS
approved