login
a(n) = 2^n - (1 + (-1)^n)/2.
10

%I #37 Sep 08 2022 08:45:48

%S 0,2,3,8,15,32,63,128,255,512,1023,2048,4095,8192,16383,32768,65535,

%T 131072,262143,524288,1048575,2097152,4194303,8388608,16777215,

%U 33554432,67108863,134217728,268435455,536870912,1073741823,2147483648,4294967295

%N a(n) = 2^n - (1 + (-1)^n)/2.

%C Partial sums of A014551. The inverse binomial transform yields a sequence 0,2,-1,5,-7,17,...: zero followed by a sign alternating A014551.

%C The table of a(n) plus higher order differences in successive rows shows A131577 on the main diagonal.

%C a(n) = 2^n when n is odd and 2^n-1 when n is even. - _Wesley Ivan Hurt_, Nov 15 2013

%H Vincenzo Librandi, <a href="/A166920/b166920.txt">Table of n, a(n) for n = 0..200</a>

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (2,1,-2).

%F G.f.: x*(2-x)/((1-x)*(1-2*x)*(1+x)).

%F a(n) = 2^n - (1+(-1)^n)/2.

%F a(2*n) = A024036(n); a(2*n+1) = A004171(n).

%F a(n) = 2*a(n-1) + a(n-2) - 2*a(n-3).

%F a(n+1) - 2*a(n) = A168361(n).

%F a(n) = A000225(n+1) - A051049(n) = A014551(n) - A168361(n).

%F E.g.f.: exp(2*x) - cosh(x). - _G. C. Greubel_, May 28 2016

%F a(n) = Sum_{k=1..n+1} Sum_{i=0..n+1} C(n-k,i). - _Wesley Ivan Hurt_, Sep 22 2017

%F a(n) = 2*A001045(n) + A000975(n-1) for n>0. - _Yuchun Ji_, Aug 30 2018

%p A166920:=n->2^n-(1+(-1)^n)/2; seq(A166920(n), n=0..50); # _Wesley Ivan Hurt_, Nov 15 2013

%t LinearRecurrence[{2,1,-2},{0,2,3},40] (* _Harvey P. Dale_, Oct 16 2012 *)

%o (Magma) [2^n -(1+(-1)^n)/2: n in [0..30]]; // _Vincenzo Librandi_, May 16 2011

%o (Haskell)

%o a166920 n = a166920_list !! n

%o a166920_list = scanl (+) 0 a014551_list

%o -- _Reinhard Zumkeller_, Jan 02 2013

%o (PARI) a(n)=2^n-(1+(-1)^n)/2 \\ _Charles R Greathouse IV_, Oct 07 2015

%Y Cf. A004171, A014551, A024036, A131577, A168361.

%K nonn,easy

%O 0,2

%A _Paul Curtz_, Oct 23 2009

%E Edited and extended by _R. J. Mathar_, Mar 02 2010