login
4th-order non-linear ("factorial") recursion: a(0)=a(1)=a(2)=a(3)=1, a(n) = (n+1)*a(n-4).
2

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

%S 1,1,1,1,5,6,7,8,45,60,77,96,585,840,1155,1536,9945,15120,21945,30720,

%T 208845,332640,504735,737280,5221125,8648640,13627845,20643840,

%U 151412625,259459200,422463195,660602880,4996616625,8821612800

%N 4th-order non-linear ("factorial") recursion: a(0)=a(1)=a(2)=a(3)=1, a(n) = (n+1)*a(n-4).

%H Reinhard Zumkeller, <a href="/A081407/b081407.txt">Table of n, a(n) for n = 0..1000</a>

%e Following sequences are interleaved: A007696: {5,45,585,..}; A000404: {6,60,840,..} A034176: {7,77,1155,..}; A034177: {8,96,1536,..}

%t f[n_]:= (n+1)*f[n-4]; f[0]=1; f[1]=1; f[2]=1; f[3]=1; Table[f[n], {n, 0, 40}]

%o (Haskell)

%o a081407 n = a081408_list !! n

%o a081407_list = 1 : 1 : 1 : 1 : zipWith (*) [5..] a081407_list

%o -- _Reinhard Zumkeller_, Jan 05 2012

%o (PARI) a(n) = if(n<4, 1, (n+1)*a(n-4) );

%o vector(35, n, a(n-1)) \\ _G. C. Greubel_, Aug 24 2019

%o (Magma) a:= func< n | n le 3 select 1 else n in [4..6] select n+1 else (n+1)*Self(n-3) >;

%o [a(n): n in [0..35]]; // _G. C. Greubel_, Aug 24 2019

%o (Sage)

%o def a(n):

%o if n<4: return 1

%o elif 4<= n <= 6: return n+1

%o else: return (n+1)*a(n-4)

%o [a(n) for n in (0..35)] # _G. C. Greubel_, Aug 24 2019

%o (GAP)

%o a:= function(k)

%o if k<4 then return 1;

%o elif k<7 then return k+1;

%o else return (k+1)*a(k-4);

%o fi;

%o end;

%o List([0..35], n-> a(n) ); # _G. C. Greubel_, Aug 24 2019

%Y Cf. A000404, A007696, A034176, A034177, A081405, A081405, A081407.

%K nonn

%O 0,5

%A _Labos Elemer_, Apr 01 2003