OFFSET
0,5
COMMENTS
a(n) is the number of terms among {floor(n/k)}, 1<=k<=n, which are even. - Leroy Quet, Jan 19 2006
FORMULA
a(n) = n - A059851(n).
a(n) = n - Sum_{n/2<k<=n} d(k) + Sum_{1<=k<=n/2} d(k), where d(k) = A000005(k). - Leroy Quet, Jan 19 2006
G.f.: ( Sum_{i>0} x^(2*i)/(1+x^i) )/(1-x). - Vladeta Jovovic, Apr 24 2006
a(n) = Sum_{i=1..n} floor(n/(2*i)) - floor((n-i)/(2*i)). - Wesley Ivan Hurt, Jan 30 2016
Conjecture: Let f(a,b)=1, if (a+b) mod |a-b| != (a mod |a-b|)+(b mod |a-b|), and 0 otherwise. a(n) = Sum_{k=1..n-1} f(n+k,n-k). - Benedict W. J. Irwin, Sep 23 2016
a(n) = Sum_{k=1..n} (floor((n-i)/i) mod 2 ). - Wesley Ivan Hurt, Dec 20 2020
EXAMPLE
a(6) = [6/2]-[6/3]+[6/4]-[6/5]+[6/6]-[6/7]+... = 3-2+1-1+1-0+... = 2.
MAPLE
A075997:=n->add(floor(n/(2*i))-floor((n-i)/(2*i)), i=1..n): seq(A075997(n), n=0..100); # Wesley Ivan Hurt, Jan 30 2016
MATHEMATICA
Table[Sum[Floor[n/(2 i)] - Floor[(n - i)/(2 i)], {i, n}], {n, 0, 100}] (* Wesley Ivan Hurt, Jan 30 2016 *)
PROG
(PARI) a(n) = sum(k=2, n, (-1)^k*(n\k)); \\ Michel Marcus, Dec 20 2020
(Python)
from math import isqrt
def A075997(n): return n+(s:=isqrt(n))**2-((t:=isqrt(m:=n>>1))**2<<1)-(sum(n//k for k in range(1, s+1))-(sum(m//k for k in range(1, t+1))<<1)<<1) # Chai Wah Wu, Oct 23 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Sep 28 2002
STATUS
approved