login
a(n) = 1 + (1-2^n)*a(n-1) for n > 0, a(0)=0.
4

%I #18 Sep 08 2022 08:45:52

%S 0,1,-2,15,-224,6945,-437534,55566819,-14169538844,7240634349285,

%T -7407168939318554,15162474818785080039,-62090334382924902759704,

%U 508581928930537878504735465,-8332097741669002063543081123094

%N a(n) = 1 + (1-2^n)*a(n-1) for n > 0, a(0)=0.

%H G. C. Greubel, <a href="/A176337/b176337.txt">Table of n, a(n) for n = 0..80</a>

%p A176337 := proc(n)

%p if n = 0 then

%p 0;

%p else

%p 1+(1-2^n)*procname(n-1) ;

%p end if;

%p end proc: # _R. J. Mathar_, May 04 2013

%t a[n_, q_]:= a[n, q]= If[n==0, 0, (1-q^n)*a[n-1, q] +1]; Table[a[n, 2], {n,0,15}]

%o (PARI) q=2; a(n,q) = if(n==0, 0, 1 -(q^n-1)*a(n-1,q) );

%o vector(15, n, a(n-1, 2)) \\ _G. C. Greubel_, Dec 07 2019

%o (Magma)

%o function a(n,q)

%o if n eq 0 then return 0;

%o else return 1 - (q^n-1)*a(n-1,q);

%o end if; return a; end function;

%o [a(n,2): n in [0..15]]; // _G. C. Greubel_, Dec 07 2019

%o (Sage)

%o def a(n, q):

%o if (n==0): return 0

%o else: return 1 - (q^n-1)*a(n-1,q)

%o [a(n,2) for n in (0..15)] # _G. C. Greubel_, Dec 07 2019

%o (GAP)

%o a:= function(n,q)

%o if n=0 then return 0;

%o else return 1 - (q^n-1)*a(n-1,q);

%o fi; end;

%o List([0..15], n-> a(n,2) ); # _G. C. Greubel_, Dec 07 2019

%Y Cf. A176338.

%K sign,easy

%O 0,3

%A _Roger L. Bagula_, Apr 15 2010