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.
%I A346731 #12 Aug 01 2021 14:43:35 %S A346731 0,1,2,3,4,5,6,7,-1,0,1,2,3,4,5,6,-2,-1,0,1,2,3,4,5,-3,-2,-1,0,1,2,3, %T A346731 4,-4,-3,-2,-1,0,1,2,3,-5,-4,-3,-2,-1,0,1,2,-6,-5,-4,-3,-2,-1,0,1,-7, %U A346731 -6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,0,1,2,3,4,5,6,7,-1,0,1,2,3,4,5,6,-2,-1,0,1,2,3,4,5,-3,-2,-1,0,1,2,3,4,-4 %N A346731 Replace 8^k with (-1)^k in base-8 expansion of n. %C A346731 If n has base-8 expansion abc..xyz with least significant digit z, a(n) = z - y + x - w + ... %F A346731 G.f. A(x) satisfies: A(x) = x * (1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 + 6*x^5 + 7*x^6) / (1 - x^8) - (1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7) * A(x^8). %F A346731 a(n) = n + 9 * Sum_{k>=1} (-1)^k * floor(n/8^k). %e A346731 79 = 117_8, 7 - 1 + 1 = 7, so a(79) = 7. %t A346731 nmax = 104; A[_] = 0; Do[A[x_] = x (1 + 2 x + 3 x^2 + 4 x^3 + 5 x^4 + 6 x^5 + 7 x^6)/(1 - x^8) - (1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7) A[x^8] + O[x]^(nmax + 1) // Normal, nmax + 1]; CoefficientList[A[x], x] %t A346731 Table[n + 9 Sum[(-1)^k Floor[n/8^k], {k, 1, Floor[Log[8, n]]}], {n, 0, 104}] %o A346731 (Python) %o A346731 from sympy.ntheory.digits import digits %o A346731 def a(n): %o A346731 return sum(bi*(-1)**k for k, bi in enumerate(digits(n, 8)[1:][::-1])) %o A346731 print([a(n) for n in range(105)]) # _Michael S. Branicky_, Jul 31 2021 %Y A346731 Cf. A007094, A053829, A055017, A065359, A065368, A346688, A346689, A346690, A346691, A346732. %K A346731 sign,base %O A346731 0,3 %A A346731 _Ilya Gutkovskiy_, Jul 30 2021