login
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.
4

%I #35 May 08 2022 23:18:08

%S 1,1,2,6,24,120,20,140,1120,10080,1008,11088,77,1001,14014,210210,

%T 3363360,57177120,1029188160,19554575040,977728752,2217072,100776,

%U 2317848,96577,2414425,62775050,1694926350,47457937800,1376280196200

%N 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.

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

%H <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a>

%t 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 *)

%o (Haskell)

%o a065422 n = a065422_list !! n

%o a065422_list = 1 : 1 : f 2 1 where

%o f n x = x' : f (n+1) x' where

%o x' | x `mod` n == 0 = until ((> 0) . (`mod` n)) (`div` n) x

%o | otherwise = x * n

%o -- _Reinhard Zumkeller_, Oct 10 2011

%Y See A008336 for another version. Cf. A005132.

%K easy,nonn,nice,look

%O 0,3

%A _Naohiro Nomoto_, Nov 23 2001

%E Definition and offset corrected by _Reinhard Zumkeller_, Oct 10 2011

%E Typo in Crossrefs fixed by _Paul Tek_, Aug 01 2015