%I #32 Sep 08 2022 08:45:54
%S 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,
%T 16,9,17,9,18,10,19,10,20,11,21,11,22,12,23,12,24,13,25,13,26,14,27,
%U 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
%N 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].
%C A008619 and A000027 interleaved; abs(a(n+1) - a(n)) = A059169(n). - _Reinhard Zumkeller_, Nov 15 2014
%H Reinhard Zumkeller, <a href="/A178804/b178804.txt">Table of n, a(n) for n = 1..10000</a>
%H "TwoPi", <a href="http://threesixty360.wordpress.com/2010/06/15/a-cool-sequence-problem/">A Cool Sequence Problem</a>
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,1,0,1,0,-1).
%F a(n) = ceiling(n/4) if n is odd, n/2 if n is even.
%F From _R. J. Mathar_, Jun 19 2010: (Start)
%F a(n) = a(n-2) + a(n-4) - a(n-6).
%F G.f.: x*(1+x+x^3) / ( (1+x^2)*(x-1)^2*(1+x)^2 ). (End)
%F a(n) = (3n+1-2(-1)^((n+3+(1-n)(-1)^n)/4)+(n-3)(-1)^n)/8. - _Wesley Ivan Hurt_, Mar 19 2015
%t 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 *)
%o (Haskell)
%o import Data.List (transpose)
%o a178804 n = a178804_list !! (n-1)
%o a178804_list = concat $ transpose [a008619_list, a000027_list]
%o -- _Reinhard Zumkeller_, Nov 15 2014
%o (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
%o (Magma) m:=90; R<x>:=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
%o (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
%Y Cf. A000027 (bisection), A008619 (bisection), A211520 (partial sums), A059169.
%K easy,nonn
%O 1,4
%A Mark McKinzie (mmckinzie(AT)sjfc.edu), Jun 15 2010
|