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.

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

This page as a plain text file.
%I A361981 #18 May 10 2023 04:31:19
%S A361981 1,4,-5,23,-2,-29,-78,146,146,71,-50,-302,-471,-618,-393,1399,1110,
%T A361981 1110,749,49,490,127,-402,-2418,-2418,-2925,-2925,-4297,-5138,-4463,
%U A361981 -5424,8912,10001,9134,10359,10359,8990,7907,9428,3828,2147,3470,1621,-1767,-1767,-3354,-5563
%N A361981 a(1) = 1; a(n) = Sum_{k=2..n} (-1)^k * k^2 * a(floor(n/k)).
%H A361981 Seiichi Manyama, <a href="/A361981/b361981.txt">Table of n, a(n) for n = 1..8191</a>
%F A361981 Sum_{k=1..n} (-1)^k * k^2 * a(floor(n/k)) = 0 for n > 1.
%F A361981 G.f. A(x) satisfies -x * (1 - x) = Sum_{k>=1} (-1)^k * k^2 * (1 - x^k) * A(x^k).
%t A361981 f[p_, e_] := If[e == 1, -p^2, 0]; f[2, e_] := If[e == 1, 3, 7*2^(3*e-4)]; s[1] = 1; s[n_] := Times @@ f @@@ FactorInteger[n]; Accumulate[Array[s, 100]] (* _Amiram Eldar_, May 09 2023 *)
%o A361981 (Python)
%o A361981 from functools import lru_cache
%o A361981 @lru_cache(maxsize=None)
%o A361981 def A361981(n):
%o A361981     if n <= 1:
%o A361981         return 1
%o A361981     c, j = 0, 2
%o A361981     k1 = n//j
%o A361981     while k1 > 1:
%o A361981         j2 = n//k1 + 1
%o A361981         c += ((j2*(j2-1) if j2&1 else -j2*(j2-1))+(-j*(j-1) if j&1 else j*(j-1))>>1)*A361981(k1)
%o A361981         j, k1 = j2, n//j2
%o A361981     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
%Y A361981 Partial sums of A361986.
%Y A361981 Cf. A309288, A359479.
%Y A361981 Cf. A360390, A361983.
%K A361981 sign,look
%O A361981 1,2
%A A361981 _Seiichi Manyama_, Apr 02 2023