A065422 If n | a(n) then a(n+1) = a(n)/(highest power of n that divides a(n)), otherwise a(n+1) = n*a(n); a(0) = 1.
1, 1, 2, 6, 24, 120, 20, 140, 1120, 10080, 1008, 11088, 77, 1001, 14014, 210210, 3363360, 57177120, 1029188160, 19554575040, 977728752, 2217072, 100776, 2317848, 96577, 2414425, 62775050, 1694926350, 47457937800, 1376280196200
Offset: 0
Links
Programs
-
Haskell
a065422 n = a065422_list !! n a065422_list = 1 : 1 : f 2 1 where f n x = x' : f (n+1) x' where x' | x `mod` n == 0 = until ((> 0) . (`mod` n)) (`div` n) x | otherwise = x * n -- Reinhard Zumkeller, Oct 10 2011
-
Mathematica
nxt[{n_,a_}]:={n+1,If[Divisible[a,n],a/n^IntegerExponent[a,n],a*n]}; Join[ {1,1},Transpose[NestList[nxt,{3,2},30]][[2]]] (* Harvey P. Dale, Jan 08 2013 *)
Extensions
Definition and offset corrected by Reinhard Zumkeller, Oct 10 2011
Typo in Crossrefs fixed by Paul Tek, Aug 01 2015