OFFSET
1,2
COMMENTS
Written in base 3, this yields A056830. - M. F. Hasler, Oct 05 2018
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
INRIA Algorithms Project, Encyclopedia of Combinatorial Structures 906
R. J. Mathar, Counting Walks on Finite Graphs, Nov 2020, Section 6.
Index entries for linear recurrences with constant coefficients, signature (3,1,-3).
FORMULA
a(n) = A039300(n)-1.
a(n)+a(n+1) = A003462(n+1).
a(n) = 3*a(n-1) + a(n-2) -3*a(n-3). - R. J. Mathar, Jun 28 2010
From Paul Barry, Nov 12 2003: (Start)
G.f.: x/((1-x)*(1+x)*(1-3*x)).
a(n) = 2*a(n-1) + 3*a(n-2) + 1.
Partial sums of A015518. (End)
E.g.f.: (1/2)*exp(x)*(sinh(x))^2. - Paul Barry, Mar 12 2003
a(n) = Sum_{k=0..floor(n/2)} C(n+2, 2k+2)*4^k. - Paul Barry, Aug 24 2003
a(n) = Sum_{k=0..floor(n/2)} 3^(n-2*k); a(n) = Sum_{k=0..n} Sum_{j=0..k} (-1)^(j+k)*3^j. - Paul Barry, Nov 12 2003
Convolution of A000244 and A059841 (3^n and periodic{1, 0}). a(n) = Sum_{k=0..n} (1 + (-1)^(n-k))*3^k/2. - Paul Barry, Jul 19 2004
a(n) = round(3^(n+1)/8) = floor((3^(n+1)-1)/8) = ceiling((3^(n+1)-3)/8) = round((3^(n+1)-3)/8). a(n) = a(n-2) + 3^(n-1), n > 2. - Mircea Merca, Dec 27 2010
a(n) = floor((3^(n+1))/4) / 2 = A081251(n)/2, n >= 1. - Wolfdieter Lang, Apr 13 2012
MAPLE
a[0]:=0: a[1]:=1: for n from 2 to 50 do a[n]:=2*a[n-1]+3*a[n-2]+1 od: seq(a[n], n=1..33); # Zerinvary Lajos, Dec 14 2008
g:=x*(1/(1-3*x)/(1-x))/(1+x): gser:=series(g, x=0, 43): seq(coeff(gser, x, n), n=1..30); # Zerinvary Lajos, Jan 11 2009
A033113 := proc(n) (9*3^(n-1)-(-1)^n-2)/8 ; end proc: # R. J. Mathar, Jan 08 2011
MATHEMATICA
Join[{a=1, b=3}, Table[c=2*b+3*a+1; a=b; b=c, {n, 60}]] (* Vladimir Joseph Stephan Orlovsky, Feb 01 2011 *)
Module[{nn=30, d}, d=PadRight[{}, nn, {1, 0}]; Table[FromDigits[Take[d, n], 3], {n, nn}]] (* or *) LinearRecurrence[{3, 1, -3}, {1, 3, 10}, 30] (* Harvey P. Dale, May 24 2014 *)
PROG
(PARI) a(n)=3^n*3\8 \\ Simplified by M. F. Hasler, Oct 06 2018
(PARI) A033113(n)=3^(n+1)>>3 \\ M. F. Hasler, Oct 05 2018
(Magma) [Round(3^(n+1)/8): n in [1..30]]; // Vincenzo Librandi, Jun 25 2011
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved