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.

A097140 Interleave n and 1-n.

Original entry on oeis.org

0, 1, 1, 0, 2, -1, 3, -2, 4, -3, 5, -4, 6, -5, 7, -6, 8, -7, 9, -8, 10, -9, 11, -10, 12, -11, 13, -12, 14, -13, 15, -14, 16, -15, 17, -16, 18, -17, 19, -18, 20, -19, 21, -20, 22, -21, 23, -22, 24, -23, 25, -24, 26, -25, 27, -26, 28, -27, 29, -28, 30, -29, 31, -30, 32, -31
Offset: 0

Views

Author

Paul Barry, Jul 29 2004

Keywords

Comments

Partial sums are A097141. Binomial transform is x(1+x)/(1-2x), or A003945 with a leading 0.

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a097140 n = a097140_list !! n
    a097140_list = concat $ transpose [a001477_list, map (1 -) a001477_list]
    -- Reinhard Zumkeller, Nov 27 2012
    
  • Mathematica
    With[{nn=35},Riffle[Range[0,nn],Range[1,-(nn-1),-1]]] (* or *) LinearRecurrence[ {-1,1,1},{0,1,1},70] (* Harvey P. Dale, Mar 26 2012 *)
  • PARI
    a(n)=3/4+(2*n-3)*(-1)^n/4 \\ Charles R Greathouse IV, Sep 02 2015

Formula

G.f.: x*(1 + 2*x)/((1 - x)*(1 + x)^2).
a(n) = 3/4 + (2*n - 3)*(-1)^n/4.
a(0)=0, a(1)=1, a(2)=1, a(n)=a(n-1)+a(n-2)+a(n-3). - Harvey P. Dale, Mar 26 2012
G.f.: x*G(0)/(1+x) where G(k) = 1 + 2*x/(1 - x/(x + 2/G(k+1) )); (recursively defined continued fraction). - Sergei N. Gladkovskii, Dec 21 2012
E.g.f.: ((3 + x)*sinh(x) - x*cosh(x))/2. - Stefano Spezia, Mar 07 2023