cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A331213 a(n) = 1 + Sum_{i=1..n} (-1)^i * Product_{j=1..i} floor(n/j).

Original entry on oeis.org

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

Views

Author

Seiichi Manyama, Jan 12 2020

Keywords

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) - ...

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.
		

Crossrefs

Cf. similar sequences: A075885 (b=1), A208060 (b=2).
Cf. A010786.

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)))}