%I #57 Sep 08 2022 08:44:51
%S 1,3,6,18,45,135,378,1134,3321,9963,29646,88938,266085,798255,2392578,
%T 7177734,21526641,64579923,193720086,581160258,1743421725,5230265175,
%U 15690618378,47071855134,141215033961,423645101883
%N Number of reversible strings with n beads of 3 colors.
%C "BIK" (reversible, indistinct, unlabeled) transform of 3, 0, 0, 0, ...
%H Vincenzo Librandi, <a href="/A032120/b032120.txt">Table of n, a(n) for n = 0..1000</a>
%H C. G. Bower, <a href="/transforms2.html">Transforms (2)</a>
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (3,3,-9).
%F a(n) = (1/2)*((2-(-1)^n)*3^floor(n/2) + 3^n). - _Ralf Stephan_, May 11 2004
%F For n>0, a(n) = 3 * A001444(n-1). - _N. J. A. Sloane_, Sep 22 2004
%F From _Colin Barker_, Apr 02 2012: (Start)
%F a(n) = 3*a(n-1) + 3*a(n-2) - 9*a(n-3).
%F G.f.: (1-6x^2) / ((1-3x)*(1-3x^2)). (End) [Adapted to offset 0 by _Robert A. Russell_, Nov 10 2018]
%F a(n) = (1/2)*(3^(ceiling(n/2)) + 3^n). - _Andrew Howroyd_, Oct 10 2017
%F a(n) = (A000244(n) + A056449(n)) / 2. - _Robert A. Russell_, Nov 10 2018
%e For a(2)=10, the four achiral strings are AA, BB, CC, and DD; the 6 (equivalent) chiral pairs are AB-BA, AC-CA, AD-DA, BC-CB, BD-DB, and CD-DC.
%t f[n_] := If[EvenQ[n], (3^n + 3^(n/2))/2, (3^n + 3^Ceiling[n/2])/2];
%t Table[f[n],{n,0,25}] (* _Geoffrey Critzer_, Apr 24 2011 *)
%t CoefficientList[Series[(1-6x^2)/((1-3x) (1-3x^2)), {x, 0, 30}], x] (* _Vincenzo Librandi_, Apr 22 2012 *) (* Adapted to offset 0 by _Robert A. Russell_, Nov 10 2018 *)
%t Table[(1/2) ((2 - (-1)^n) 3^Floor[n/2] + 3^n), {n, 0, 25}]. (* _Bruno Berselli_, Apr 22 2012 *)
%t LinearRecurrence[{3, 3, -9}, {1, 3, 6}, 31] (* _Robert A. Russell_, Nov 10 2018 *)
%o (Magma) I:=[1, 3, 6]; [n le 3 select I[n] else 3*Self(n-1)+3*Self(n-2)-9*Self(n-3): n in [1..25]]; // _Vincenzo Librandi_, Apr 22 2012
%o (PARI) a(n) = (3^n + 3^(ceil(n/2)))/2; \\ _Andrew Howroyd_, Oct 10 2017
%Y Column 3 of A277504.
%Y Cf. A000244 (oriented), A032086(n>1) (chiral), A056449 (achiral).
%K nonn,easy
%O 0,2
%A _Christian G. Bower_
%E a(0)=1 prepended by _Robert A. Russell_, Nov 10 2018