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 A384868 #44 Jun 18 2025 21:18:34 %S A384868 0,1,-1,3,-1,1,-3,6,0,2,-4,4,-2,0,-6,10,2,4,-4,6,-2,0,-8,8,0,2,-6,4, %T A384868 -4,-2,-10,15,5,7,-3,9,-1,1,-9,11,1,3,-7,5,-5,-3,-13,13,3,5,-5,7,-3, %U A384868 -1,-11,9,-1,1,-9,3,-7,-5,-15,21,9,11,-1,13,1,3,-9,15,3,5,-7,7,-5,-3,-15,17 %N A384868 a(n) = Sum_{i=1...|b|} i*(-1)^b_i where b is the lexicographically n-th binary string. %C A384868 The first binary string is the empty string and is indexed n=0. %H A384868 Alois P. Heinz, <a href="/A384868/b384868.txt">Table of n, a(n) for n = 0..16383</a> %F A384868 From _Alois P. Heinz_, Jun 13 2025: (Start) %F A384868 a(A000225(n)) = A000217(n). %F A384868 a(2*(2^n-1)) = (-1)*A000217(n). %F A384868 Sum_{i=0..2^n-1} a(i+2^n-1) = 0. %F A384868 Sum_{i=0..2^n-1} i*a(i+2^n-1) = (-1)*A100575(n+1). %F A384868 Sum_{i=0..2^n-1} abs(a(i+2^n-1)) = 2*A377170(n). (End) %e A384868 The lexicographically 8th binary string is 001; therefore, a(8) = 1 + 2 - 3 = 0. %e A384868 Sequence can be written as triangle T(n,k) with row lengths 2^n: %e A384868 0; %e A384868 1, -1; %e A384868 3, -1, 1, -3; %e A384868 6, 0, 2, -4, 4, -2, 0, -6; %e A384868 10, 2, 4, -4, 6, -2, 0, -8, 8, 0, 2, -6, 4, -4, -2, -10; %e A384868 ... %o A384868 (PARI) a(n) = my(b=[d|d<-binary(n+1)[^1]]); sum(i=1, #b, i*(-1)^b[i]); \\ _Michel Marcus_, Jun 11 2025 %o A384868 (Python) %o A384868 from math import comb %o A384868 def A384868(n): return comb(len(s:=bin(n+1)[3:])+1,2)-(sum(i for i,j in enumerate(s,1) if j=='1')<<1) # _Chai Wah Wu_, Jun 13 2025 %o A384868 (Python) def a384868(n): return sum(i if b == '0' else -i for i, b in enumerate(bin(n + 1)[3:], 1)) # _David Radcliffe_, Jun 15 2025 %Y A384868 Cf. A000079, A000217, A000225, A007931, A100575, A231204, A365968, A377170. %K A384868 sign,tabf,look,easy %O A384868 0,4 %A A384868 _Christopher Purcell_, Jun 11 2025