login
a(n) = (3^(n+2)+11)/2 - 5*2^(n+1) + 2*n.
2

%I #20 Mar 11 2024 01:54:04

%S 0,1,10,53,218,789,2658,8581,26986,83477,255506,776709,2350554,

%T 7092565,21359554,64242437,193054922,579820053,1740770802,5224933765,

%U 15680044090,47050617941,141172825250,423560418693,1270765142058,3812463198229,11437725138898,34313846505221,102942881692826

%N a(n) = (3^(n+2)+11)/2 - 5*2^(n+1) + 2*n.

%C Partial sums of A281773; first differences of A285361.

%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (7,-17,17,-6)

%F G.f.: x*(1+3*x) / ( (3*x-1)*(2*x-1)*(x-1)^2 ). - _R. J. Mathar_, Jan 21 2018

%F a(n) = A249999(n-1) +3*A249999(n-2). - _R. J. Mathar_, Jan 21 2018

%t Array[(3^(# + 2) + 11)/2 - 5*2^(# + 1) + 2 # &, 29, 0] (* or *)

%t CoefficientList[Series[x (1 + 3 x)/((3 x - 1) (2 x - 1) (x - 1)^2), {x, 0, 28}], x] (* _Michael De Vlieger_, Jan 21 2018 *)

%o (PARI) A298564(n)=2*n-5<<(n+1)+3^(n+2)\2+5

%o (Python)

%o def A298564list(n):

%o def generator():

%o a, b, c = 5, 3, 0

%o while True:

%o yield c

%o a *= 2

%o b *= 3

%o c += 2 - a + b

%o a = generator()

%o return [next(a) for _ in range(n)]

%o print(A298564list(29)) # _Peter Luschny_, Jan 22 2018

%Y Cf. A281773, A285361.

%K nonn,easy

%O 0,3

%A _M. F. Hasler_, Jan 21 2018