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.

A029578 The natural numbers interleaved with the even numbers.

Original entry on oeis.org

0, 0, 1, 2, 2, 4, 3, 6, 4, 8, 5, 10, 6, 12, 7, 14, 8, 16, 9, 18, 10, 20, 11, 22, 12, 24, 13, 26, 14, 28, 15, 30, 16, 32, 17, 34, 18, 36, 19, 38, 20, 40, 21, 42, 22, 44, 23, 46, 24, 48, 25, 50, 26, 52, 27, 54, 28, 56, 29, 58, 30, 60, 31, 62, 32, 64, 33, 66, 34, 68, 35, 70, 36, 72
Offset: 0

Views

Author

Keywords

Comments

a(n) = number of ordered, length two, compositions of n with at least one odd summand - Len Smiley, Nov 25 2001
Also number of 0's in n-th row of triangle in A071037. - Hans Havermann, May 26 2002
For n > 2: a(n) = number of odd terms in row n-2 of triangle A265705. - Reinhard Zumkeller, Dec 15 2015

Crossrefs

Cf. A065423 (at least one even summand).
Cf. A001477, A005843, A009531, A071037, A211538 (partial sums), A265705.

Programs

  • Haskell
    import Data.List (transpose)
    a029578 n =  (n - n `mod` 2) `div` (2 - n `mod` 2)
    a029578_list = concat $ transpose [a001477_list, a005843_list]
    -- Reinhard Zumkeller, Nov 27 2012
    
  • Magma
    A029578:= func< n | (n + (n-2)*(n mod 2))/2 >;
    [A029578(n): n in [0..80]]; // G. C. Greubel, Jan 22 2025
    
  • Mathematica
    With[{nn=40},Riffle[Range[0,nn],Range[0,2nn,2]]] (* or *) LinearRecurrence[ {0,2,0,-1},{0,0,1,2},80] (* Harvey P. Dale, Aug 23 2015 *)
  • PARI
    a(n)=if(n%2,n-1,n/2)
    
  • Python
    def A029578(n): return (n + (n-2)*(n%2))//2
    print([A029578(n) for n in range(81)]) # G. C. Greubel, Jan 22 2025

Formula

a(n) = (3*n - 2 - (-1)^n*(n - 2))/4.
a(n+4) = 2*a(n+2) - a(n).
G.f.: x^2*(1 + 2*x)/(1-x^2)^2.
a(n) = floor((n+1)/2) + (n is odd)*floor((n+1)/2).
a(n) = (n - n mod 2)/(2 - n mod 2). - Reinhard Zumkeller, Jul 30 2002
a(n) = floor(n/2)*binomial(2, mod(n, 2)) - Paul Barry, May 25 2003
a(2*n) = n.
a(2*n-1) = 2*n-2.
a(-n) = -A065423(n+2).
a(n) = Sum_{k=0..floor((n-2)/2)} (C(n-k-2, k) mod 2)((1+(-1)^k)/2)*2^A000120(n-2k-2). - Paul Barry, Jan 06 2005
a(n) = Sum_{k=0..n-2} gcd(n-k-1, k+1). - Paul Barry, May 03 2005
For n>6: a(n) = floor(a(n-1)*a(n-2)/a(n-3)). - Reinhard Zumkeller, Mar 06 2011
E.g.f.: (1/4)*((x+2)*exp(-x) + (3*x-2)*exp(x)). - G. C. Greubel, Jan 22 2025

Extensions

Explicated definition by Reinhard Zumkeller, Nov 27 2012
Title simplified by Sean A. Irvine, Feb 29 2020