%I #12 Dec 26 2019 05:35:20
%S 1,2,6,30,5,20,140,1260,126,1386,18018,1287,10296,858,14586,277134,
%T 12597,201552,4635696,193154,2897310,111435,3120180,156009,7429,
%U 133722,3343050,96948450,3231615,100180065,3205762080,94287120,3488623440,91805880,2295147
%N a(1) = 1 and for any n > 1, if A330647(n) divides a(n-1) then a(n) = a(n-1) / A330647(n), otherwise a(n) = a(n-1) * A330647(n).
%C This sequence has similarities with A008336.
%H Rémy Sigrist, <a href="/A330648/b330648.txt">Table of n, a(n) for n = 1..1000</a>
%e The first terms, alongside the corresponding A330647(n), are:
%e n a(n) A330647(n)
%e -- ---- ----------
%e 1 1 1
%e 2 2 2
%e 3 6 3
%e 4 30 5
%e 5 5 6
%e 6 20 4
%e 7 140 7
%e 8 1260 9
%e 9 126 10
%e 10 1386 11
%t Nest[Append[#1, Block[{k = 2, s}, While[Nand[FreeQ[#1[[All, 1]], k], MemberQ[{1, k}, Set[s, GCD[#3, k]]]], k++]; {k, If[s == 1, #3 k, #3/k], If[Mod[#3, k] == 0, #3/k, #3 k]}]] & @@ {#, #[[-1, 1]], #[[-1, 2]], #[[-1, -1]]} &, {{1, 1, 1}}, 34][[All, -1]] (* _Michael De Vlieger_, Dec 23 2019 *)
%o (PARI) x=1; s=0; for (n=1, 35, for (v=1, oo, if (!bittest(s,v), if (gcd(x,v)==1, s+=2^v; x*=v; break, x%v==0, s+=2^v; x/=v; break))); print1 (x", "))
%Y Cf. A008336, A330647.
%K nonn
%O 1,2
%A _Rémy Sigrist_, Dec 22 2019
|