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 A368595 #19 Jan 02 2024 02:38:50 %S A368595 -1,1,0,4,3,5,4,12,11,13,12,16,15,17,16,32,31,33,32,36,35,37,36,44,43, %T A368595 45,44,48,47,49,48,80,79,81,80,84,83,85,84,92,91,93,92,96,95,97,96, %U A368595 112,111,113,112,116,115,117,116,124,123,125,124,128,127,129,128 %N A368595 Alternating sum of A006519. %C A368595 a(n) <= (n/2)*log_2 n, with equality at powers of 2. %F A368595 a(n) = Sum_{i=1..n} (-1)^i*A006519(i). %F A368595 a(n) = A136013(n) - (n mod 2). - _Kevin Ryde_, Jan 01 2024 %t A368595 a[1]=-1;a[n_]:=If[OddQ[n],a[n-1]-2^IntegerExponent[n,2],a[n-1]+2^IntegerExponent[n,2]];Table[a[n],{n,63}] (* _James C. McMahon_, Dec 31 2023 *) %o A368595 (PARI) a(n) = fromdigits(Vec(Pol(binary(n))'),2) - bitand(n,1); \\ _Kevin Ryde_, Jan 01 2024 %o A368595 (Python) %o A368595 def A368595(n): return sum(map(lambda x:(x[0]+1)*(1<<x[0]), filter(lambda x:x[1]=='1', enumerate(bin(n)[-2:1:-1]))))-(n&1) # _Chai Wah Wu_, Jan 01 2024 %Y A368595 Cf. A006519. A006520 (all positive signs), A136013. %Y A368595 Cf. A093347 (with powers of 3). %K A368595 sign,easy %O A368595 1,4 %A A368595 _Jeffrey Shallit_, Dec 31 2023