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.

A361983 a(n) = 1 + Sum_{k=2..n} (-1)^k * k^2 * a(floor(n/k)).

Original entry on oeis.org

1, 5, -4, 28, 3, -33, -82, 174, 174, 74, -47, -335, -504, -700, -475, 1573, 1284, 1284, 923, 123, 564, 80, -449, -2753, -2753, -3429, -3429, -4997, -5838, -4938, -5899, 10485, 11574, 10418, 11643, 11643, 10274, 8830, 10351, 3951, 2270, 4034, 2185, -1687, -1687, -3803
Offset: 1

Views

Author

Seiichi Manyama, Apr 02 2023

Keywords

Crossrefs

Partial sums of A361987.
Cf. A336276.

Programs

  • Mathematica
    f[p_, e_] := If[e == 1, -p^2, 0]; f[2, e_] := 2^(3*e - 1); s[1] = 1; s[n_] := Times @@ f @@@ FactorInteger[n]; Accumulate[Array[s, 100]] (* Amiram Eldar, May 09 2023 *)
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A361983(n):
        if n <= 1:
            return 1
        c, j = 1, 2
        k1 = n//j
        while k1 > 1:
            j2 = n//k1 + 1
            c += ((j2*(j2-1) if j2&1 else -j2*(j2-1))+(-j*(j-1) if j&1 else j*(j-1))>>1)*A361983(k1)
            j, k1 = j2, n//j2
        return c+((-n*(n+1) if n&1 else n*(n+1))+(-j*(j-1) if j&1 else j*(j-1))>>1) # Chai Wah Wu, Apr 02 2023

Formula

Sum_{k=1..n} (-1)^k * k^2 * a(floor(n/k)) = -1.
G.f. A(x) satisfies -x = Sum_{k>=1} (-1)^k * k^2 * (1 - x^k) * A(x^k).