A331213 a(n) = 1 + Sum_{i=1..n} (-1)^i * Product_{j=1..i} floor(n/j).
1, 0, 1, -2, 5, -4, 13, -27, 89, -80, 191, -450, 2365, -1182, 3221, -13034, 40433, -22320, 96373, -193761, 772981, -728930, 1599357, -3428425, 21411337, -13595724, 31407273, -110011850, 377746853, -198079308, 1096983421, -2241234465, 7565512161, -6472208192
Offset: 0
Keywords
Examples
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.
Links
- Seiichi Manyama, Table of n, a(n) for n = 0..1000
Programs
-
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
-
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 *)
-
PARI
{a(n) = 1+sum(i=1, n, (-1)^i*prod(j=1, i, floor(n/j)))}
Comments