login
a(n) = 3*a(n-1)*a(n-2)*a(n-3)*a(n-4) - a(n-5), with a(1)=a(2)=a(3)=a(4)=a(5)=1.
2

%I #26 Sep 08 2022 08:45:27

%S 1,1,1,1,1,2,5,29,869,756029,285790302433,16335219393063437264866,

%T 9201358366190200404401435237110861938769705

%N a(n) = 3*a(n-1)*a(n-2)*a(n-3)*a(n-4) - a(n-5), with a(1)=a(2)=a(3)=a(4)=a(5)=1.

%H G. C. Greubel, <a href="/A121910/b121910.txt">Table of n, a(n) for n = 1..17</a>

%p a:= proc(n) option remember;

%p if n<6 then 1 else 3*a(n-1)*a(n-2)*a(n-3)*a(n-4) - a(n-5) fi;

%p end:

%p seq(a(n), n=1..15); # _G. C. Greubel_, Oct 07 2019

%t a[n_]:= a[n]= If[n<6, 1, 3*a[n-1]*a[n-2]*a[n-3]*a[n-4] - a[n-5]]; Table[a[n], {n, 15}] (* modified by _G. C. Greubel_, Oct 07 2019 *)

%o (PARI) my(m=15, v=concat([1,1,1,1,1], vector(m-5))); for(n=6, m, v[n] = 3*v[n-1] *v[n-2]*v[n-3]*v[n-4] - v[n-5]); v \\ _G. C. Greubel_, Oct 07 2019

%o (Magma) [n lt 6 select 1 else 3*Self(n-1)*Self(n-2)*Self(n-3)*Self(n-4) - Self(n-5): n in [1..15]]; // _G. C. Greubel_, Oct 07 2019

%o (Sage)

%o def a(n):

%o if (n<6): return 1

%o else: return 3*a(n-1)*a(n-2)*a(n-3)*a(n-4) - a(n-5)

%o [a(n) for n in (1..15)] # _G. C. Greubel_, Oct 07 2019

%o (GAP)

%o a:= function(n)

%o if n<6 then return 1;

%o else return 3*a(n-1)*a(n-2)*a(n-3)*a(n-4) - a(n-5);

%o fi;

%o end;

%o List([1..15], n-> a(n) ); # _G. C. Greubel_, Oct 05 2019

%Y Cf. A072879, A121897.

%K nonn

%O 1,6

%A _Roger L. Bagula_, Sep 09 2006

%E Edited by _N. J. A. Sloane_, Sep 15 2006

%E Definition adapted to offset by _Georg Fischer_, Jun 18 2021