login
a(n+1) = a(n)/n! if n! divides a(n) else a(n)*n!.
2

%I #17 Jul 11 2018 04:33:21

%S 1,1,2,12,288,34560,48,241920,6,2177280,7900913664000,

%T 315379190543155200000,658409472000,4099929477061017600000,

%U 47029248000,61498942155915264000000,2939328000,1045482016650559488000000,163296000

%N a(n+1) = a(n)/n! if n! divides a(n) else a(n)*n!.

%H Harvey P. Dale, <a href="/A008338/b008338.txt">Table of n, a(n) for n = 1..190</a>

%H R. K. Guy and R. J. Nowakowski, <a href="https://www.jstor.org/stable/2975272">Monthly unsolved problems</a>, 1969-1995, Amer. Math. Monthly, 102 (1995), 921-926.

%p A008338 := proc(n) option remember; if n = 1 then 1 elif A008338(n-1) mod (n-1)! = 0 then A008338(n-1)/(n-1)! else A008338(n-1)*(n-1)!; fi; end;

%t a[1] := 1; a[n_] := If[IntegerQ[a[n - 1]/(n - 1)! ], a[n - 1]/(n - 1)!, a[n - 1]*(n - 1)! ]; Table[a[n], {n, 1, 20}] (* _Stefan Steinerberger_, Apr 08 2006 *)

%t Transpose[NestList[{First[#]+1,If[Divisible[Last[#],First[#]!], Last[#]/First[#]!, Last[#]First[#]!]}&,{1,1},20]][[2]] (* _Harvey P. Dale_, Oct 24 2011 *)

%K nonn,easy,nice

%O 1,3

%A _N. J. A. Sloane_

%E More terms from _Stefan Steinerberger_, Apr 08 2006