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.

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

This page as a plain text file.
%I A347031 #14 Apr 04 2023 22:09:31
%S A347031 1,0,1,1,2,-1,0,0,2,-1,0,2,3,0,3,3,4,-4,-3,-1,2,-1,0,0,2,-1,3,5,6,-7,
%T A347031 -6,-6,-3,-6,-3,7,8,5,8,8,9,-4,-3,-1,7,4,5,5,7,-1,2,4,5,-15,-12,-12,
%U A347031 -9,-12,-11,7,8,5,13,13,16,3,4,6,9,-4,-3,-7,-6,-9,-1
%N A347031 a(n) = 1 - Sum_{k=2..n} (-1)^k * a(floor(n/k)).
%C A347031 Partial sums of A308077.
%H A347031 Seiichi Manyama, <a href="/A347031/b347031.txt">Table of n, a(n) for n = 1..10000</a>
%H A347031 Ilya Gutkovskiy, <a href="/A347031/a347031.jpg">Scatterplot of a(n) up to n=10000</a>
%F A347031 G.f. A(x) satisfies: A(x) = (1/(1 - x)) * (x - Sum_{k>=2} (-1)^k * (1 - x^k) * A(x^k)).
%t A347031 a[n_] := a[n] = 1 - Sum[(-1)^k a[Floor[n/k]], {k, 2, n}]; Table[a[n], {n, 1, 75}]
%t A347031 nmax = 75; A[_] = 0; Do[A[x_] = (1/(1 - x)) (x - Sum[(-1)^k (1 - x^k) A[x^k], {k, 2, nmax}]) + O[x]^(nmax + 1) // Normal, nmax + 1]; CoefficientList[A[x], x] // Rest
%o A347031 (Python)
%o A347031 from functools import lru_cache
%o A347031 @lru_cache(maxsize=None)
%o A347031 def A347031(n):
%o A347031     if n <= 1:
%o A347031         return n
%o A347031     c, j = 1, 2
%o A347031     k1 = n//j
%o A347031     while k1 > 1:
%o A347031         j2 = n//k1 + 1
%o A347031         c += (j2-j&1)*(1 if j&1 else -1)*A347031(k1)
%o A347031         j, k1 = j2, n//j2
%o A347031     return c+(n+1-j&1)*(1 if j&1 else -1) # _Chai Wah Wu_, Apr 04 2023
%Y A347031 Cf. A002321, A025523, A308077, A309288, A347030.
%K A347031 sign
%O A347031 1,5
%A A347031 _Ilya Gutkovskiy_, Aug 11 2021