%I #33 Jul 12 2022 14:35:50
%S 1,-1,2,-2,1,-1,3,-3,1,-1,2,-2,1,-1,4,-4,1,-1,2,-2,1,-1,3,-3,1,-1,2,
%T -2,1,-1,5,-5,1,-1,2,-2,1,-1,3,-3,1,-1,2,-2,1,-1,4,-4,1,-1,2,-2,1,-1,
%U 3,-3,1,-1,2,-2,1,-1,6,-6,1,-1,2,-2,1,-1,3,-3,1,-1,2,-2,1,-1,4,-4,1,-1,2,-2,1,-1,3,-3,1,-1,2,-2,1,-1,5,-5,1,-1,2,-2,1,-1,3,-3
%N First differences of A001511.
%C For n even, Sum_{k=1..n} a(k) > 0. For n odd, Sum_{k=1..n} a(k) = 0. - _James Spahlinger_, Oct 13 2013
%H James Spahlinger, <a href="/A094267/b094267.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n) = (-1)^n * A050603(n).
%F G.f.: -1/x + (1 - x)*Sum_{k>=0} x^(2^k-2)/(1 - x^(2^k)). - _Ilya Gutkovskiy_, Feb 28 2017
%e G.f. = 1 - x + 2*x^2 - 2*x^3 + x^4 - x^5 + 3*x^6 - 3*x^7 + x^8 - x^9 + ...
%o (PARI) a(n)=(-1)^n*valuation(n+2-n%2,2) \\ _Charles R Greathouse IV_, Oct 14 2013
%o (PARI) {a(n) = my(A); if( n<0, 0, A = sum(k=0, length( binary(n+2)) - 1, x^(2^k) / (1 - x^(2^k)), x^3 * O(x^n)); polcoeff( (A * (1 - x) - x) / x^2, n))}; /* _Michael Somos_, May 11 2014 */
%o (Python)
%o def A094267(n): return (((m:=n>>1)&~(m+1)).bit_length()+1)*(-1 if n&1 else 1) # _Chai Wah Wu_, Jul 12 2022
%Y Absolute values give A050603. Cf. A001511, A005187.
%K sign,easy
%O 0,3
%A _N. J. A. Sloane_, Jun 03 2004