%I #20 Oct 23 2023 17:24:56
%S 1,1,2,1,3,2,3,2,5,3,4,3,6,5,6,3,7,6,7,6,9,6,7,6,11,9,10,7,10,9,10,9,
%T 14,11,12,9,13,12,13,10,15,14,15,14,17,12,13,12,19,17,18,15,18,17,18,
%U 15,20,17,18,17,22,21,22,17,23,20,21,20,23,20,21,20,27,26,27,22,25,22,23,22
%N a(n) = Sum_{k=1..n} (ceiling(n/k) mod 2).
%C a(n) = number of terms among {ceiling(n/k)}, 1 <= k <= n, that are odd.
%H Alois P. Heinz, <a href="/A330926/b330926.txt">Table of n, a(n) for n = 1..10000</a>
%F G.f.: (x/(1 - x)) * (1 + Sum_{k>=1} x^(2*k) / (1 + x^k)).
%F a(n) = n - Sum_{k=1..n-1} A048272(k).
%F a(n) = A075997(n-1) + 1.
%p b:= n-> add((-1)^d, d=numtheory[divisors](n)):
%p a:= proc(n) option remember; `if`(n>0, 1+b(n-1)+a(n-1), 0) end:
%p seq(a(n), n=1..80); # _Alois P. Heinz_, May 25 2020
%t Table[Sum[Mod[Ceiling[n/k], 2], {k, 1, n}], {n, 1, 80}]
%t Table[n - Sum[DivisorSum[k, (-1)^(# + 1) &], {k, 1, n - 1}], {n, 1, 80}]
%t nmax = 80; CoefficientList[Series[x/(1 - x) (1 + Sum[x^(2 k)/(1 + x^k), {k, 1, nmax}]), {x, 0, nmax}], x] // Rest
%o (PARI) a(n) = sum(k=1, n, ceil(n/k) % 2); \\ _Michel Marcus_, May 25 2020
%o (Python)
%o from math import isqrt
%o def A330926(n): return n+(s:=isqrt(n-1))**2-((t:=isqrt(m:=n-1>>1))**2<<1)-(sum((n-1)//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
%Y Cf. A002541, A006218, A048272, A059851, A075997, A120885, A320226, A325939, A332682, A333194.
%K nonn
%O 1,3
%A _Ilya Gutkovskiy_, May 25 2020