login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A123144 a(1) = 1, a(n) = a(n-1) if n = 1 (mod 3), otherwise n*a(n-1). 2

%I #18 Jul 16 2023 16:57:35

%S 1,2,6,6,30,180,180,1440,12960,12960,142560,1710720,1710720,23950080,

%T 359251200,359251200,6107270400,109930867200,109930867200,

%U 2198617344000,46170964224000,46170964224000,1061932177152000,25486372251648000,25486372251648000

%N a(1) = 1, a(n) = a(n-1) if n = 1 (mod 3), otherwise n*a(n-1).

%C Without duplicates this sequence is A293653.

%H Harvey P. Dale, <a href="/A123144/b123144.txt">Table of n, a(n) for n = 1..632</a>

%p a:= proc(n) option remember; `if`(n=0, 1,

%p `if`(irem(n, 3)=1, 1, n)*a(n-1))

%p end:

%p seq(a(n), n=1..32); # _Alois P. Heinz_, Jul 16 2023

%t a[n_]:= a[n]= If[n==1, 1, If[Mod[n,3]==1, a[n-1], n*a[n-1]]];

%t Table[a[n], {n,30}]

%t nxt[{n_,a_}]:={n+1,If[Mod[n+1,3]==1,a,a(n+1)]}; Transpose[NestList[nxt,{1,1},20]][[2]] (* _Harvey P. Dale_, Jul 22 2014 *)

%o (Magma)

%o function a(n)

%o if n eq 1 then return 1;

%o elif (n mod 3) eq 1 then return a(n-1);

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

%o end if;

%o end function;

%o [a(n): n in [1..40]]; // _G. C. Greubel_, Jul 16 2023

%o (SageMath)

%o def a(n): # A123144

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

%o elif (n%3==1): return a(n-1)

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

%o [a(n) for n in range(1,41)] # _G. C. Greubel_, Jul 16 2023

%Y Cf. A007559, A123145, A293653.

%K nonn

%O 1,2

%A _Roger L. Bagula_, Oct 01 2006

%E Edited by _N. J. A. Sloane_, Oct 04 2006

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 22:17 EDT 2024. Contains 371964 sequences. (Running on oeis4.)