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.

A094267 First differences of A001511.

Original entry on oeis.org

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, 1, -1, 2, -2, 1, -1, 4, -4, 1, -1, 2, -2, 1, -1, 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
Offset: 0

Views

Author

N. J. A. Sloane, Jun 03 2004

Keywords

Comments

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

Examples

			G.f. = 1 - x + 2*x^2 - 2*x^3 + x^4 - x^5 + 3*x^6 - 3*x^7 + x^8 - x^9 + ...
		

Crossrefs

Absolute values give A050603. Cf. A001511, A005187.

Programs

  • PARI
    a(n)=(-1)^n*valuation(n+2-n%2,2) \\ Charles R Greathouse IV, Oct 14 2013
    
  • 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 */
    
  • Python
    def A094267(n): return (((m:=n>>1)&~(m+1)).bit_length()+1)*(-1 if n&1 else 1) # Chai Wah Wu, Jul 12 2022

Formula

a(n) = (-1)^n * A050603(n).
G.f.: -1/x + (1 - x)*Sum_{k>=0} x^(2^k-2)/(1 - x^(2^k)). - Ilya Gutkovskiy, Feb 28 2017