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.

A178804 When dealing cards into 3 piles (Left, Center, Right), the number of cards in the n-th card's pile, if dealing in a pattern L, C, R, C, L, C, R, C, L, C, ... [as any thoughtful six-year-old will try to do when sharing a pile of candy among 3 people].

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 2, 4, 3, 5, 3, 6, 4, 7, 4, 8, 5, 9, 5, 10, 6, 11, 6, 12, 7, 13, 7, 14, 8, 15, 8, 16, 9, 17, 9, 18, 10, 19, 10, 20, 11, 21, 11, 22, 12, 23, 12, 24, 13, 25, 13, 26, 14, 27, 14, 28, 15, 29, 15, 30, 16, 31, 16, 32, 17, 33, 17, 34, 18, 35, 18, 36, 19, 37, 19, 38, 20, 39, 20
Offset: 1

Views

Author

Mark McKinzie (mmckinzie(AT)sjfc.edu), Jun 15 2010

Keywords

Comments

A008619 and A000027 interleaved; abs(a(n+1) - a(n)) = A059169(n). - Reinhard Zumkeller, Nov 15 2014

Crossrefs

Cf. A000027 (bisection), A008619 (bisection), A211520 (partial sums), A059169.

Programs

  • Haskell
    import Data.List (transpose)
    a178804 n = a178804_list !! (n-1)
    a178804_list = concat $ transpose [a008619_list, a000027_list]
    -- Reinhard Zumkeller, Nov 15 2014
    
  • Magma
    m:=90; R:=PowerSeriesRing(Integers(), m); Coefficients(R!( x*(1+x+x^3)/((1+x^2)*(x-1)^2*(1+x)^2) )); // G. C. Greubel, Jan 23 2019
    
  • Mathematica
    CoefficientList[Series[x*(1+x+x^3)/((1+x^2)*(x-1)^2*(1+x)^2), {x,0,90}], x] (* G. C. Greubel, Jan 23 2019 *)
  • PARI
    my(x='x+O('x^90)); Vec(x*(1+x+x^3)/((1+x^2)*(x-1)^2*(1+x)^2)) \\ G. C. Greubel, Jan 23 2019
    
  • Sage
    a=(x*(1+x+x^3)/((1+x^2)*(x-1)^2*(1+x)^2)).series(x, 90).coefficients(x, sparse=False); a[1:] # G. C. Greubel, Jan 23 2019

Formula

a(n) = ceiling(n/4) if n is odd, n/2 if n is even.
From R. J. Mathar, Jun 19 2010: (Start)
a(n) = a(n-2) + a(n-4) - a(n-6).
G.f.: x*(1+x+x^3) / ( (1+x^2)*(x-1)^2*(1+x)^2 ). (End)
a(n) = (3n+1-2(-1)^((n+3+(1-n)(-1)^n)/4)+(n-3)(-1)^n)/8. - Wesley Ivan Hurt, Mar 19 2015