login
A275495
a(n) = Sum_{k=2..n} floor(n/k) - 2*floor(n/(2*k)).
4
0, 1, 2, 2, 3, 4, 5, 4, 6, 7, 8, 7, 8, 9, 12, 10, 11, 12, 13, 12, 15, 16, 17, 14, 16, 17, 20, 19, 20, 21, 22, 19, 22, 23, 26, 24, 25, 26, 29, 26, 27, 28, 29, 28, 33, 34, 35, 30, 32, 33, 36, 35, 36, 37, 40, 37, 40, 41, 42, 39, 40, 41, 46, 42, 45, 46, 47, 46, 49
OFFSET
1,3
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = Sum_{i=1..n} floor((n-i)/i)*(-1)^(i+1). - Wesley Ivan Hurt, Sep 13 2017
a(n) = Sum_{i=2..n} (floor(n/i) mod 2) = A059851(n) - (n mod 2). - Ridouane Oudra, Oct 20 2019
a(n) ~ log(2) * n. - Vaclav Kotesovec, May 28 2021
MAPLE
seq(add(floor(n/k)-2*floor(n/(2*k)), k=2..n), n=1..60); # Ridouane Oudra, Oct 20 2019
MATHEMATICA
Table[Sum[Floor[n/k] - 2*Floor[n/(2*k)], {k, 2, n}], {n, 1, 50}] (* G. C. Greubel, Jul 30 2016 *)
PROG
(Sage)
[sum([floor(n/k) - 2*floor(n/(2*k)) for k in (2..n)]) for n in (1..69)]
(PARI) a(n)=sum(k=2, n, n\k) - 2*sum(k=2, n\2, n\(2*k)) \\ Charles R Greathouse IV, Jul 30 2016
CROSSREFS
Cf. A002541, row sums of A275510, A059851.
Sequence in context: A224401 A252462 A094457 * A022820 A292259 A241397
KEYWORD
nonn,easy
AUTHOR
Peter Luschny, Jul 30 2016
STATUS
approved