OFFSET
0,4
COMMENTS
Compare to the exponential series: exp(-n) = 1 - n + n*(n/2) - n*(n/2)*(n/3) + n*(n/2)*(n/3)*(n/4) - ...
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..1000
EXAMPLE
a(4) = 1 - 4 + 4*floor(4/2) - 4*floor(4/2)*floor(4/3) + 4*floor(4/2)*floor(4/3)*floor(4/4) = 1 - 4 + 4*2 - 4*2*1 + 4*2*1*1 = 5.
MATHEMATICA
a[n_] := 1 + Sum[(-1)^i * Product[Floor[n/j], {j, 1, i}], {i, 1, n}]; Array[a, 34, 0] (* Amiram Eldar, Jan 13 2020 *)
PROG
(PARI) {a(n) = 1+sum(i=1, n, (-1)^i*prod(j=1, i, floor(n/j)))}
(Magma) [1] cat [1+&+[(-1)^i*(&*[Floor(n/j):j in [1..i]]):i in [1..n]]:n in [1..33]]; // Marius A. Burtea, Jan 13 2020
CROSSREFS
KEYWORD
sign
AUTHOR
Seiichi Manyama, Jan 12 2020
STATUS
approved