%I #19 May 14 2024 19:53:12
%S 1,6,2,1,9,3,17,60,20,2,18,3,23,84,28,7,39,13,59,198,66,3,33,11,59,
%T 204,68,17,81,27,113,372,124,62,222,37,1,42,14,7,63,3,53,204,68,34,
%U 150,25,125,5,67,254,816,136,464,58,232,4,72,6,80,40,184,23,135
%N a(1) = 1, a(n) = a(n-1) / gcd(a(n-1),n) if this gcd is > 1, else a(n) = 3*a(n-1) + n + 1.
%C A variant of A133058. The behavior of simple computational models of the form a(1), a(n) = a(n-1) / gcd(a(n-1),n) if this gcd is > 1, else a(n) = X*a(n-1) + Y*n + R, depending on parameters [X, Y, R], shows Wolfram complexity classes for cellular automata.
%H Robert Israel, <a href="/A334943/b334943.txt">Table of n, a(n) for n = 1..10000</a>
%e a(2) = 3*a(1) + 2 + 1 = 6, a(3) = a(2)/3 = 2, a(4) = a(3)/2 = 1, a(5) = 3*a(4) + 5 + 1 = 9, ...
%p N:= 100: # for a(1)..a(N)
%p V:= Vector(N):
%p V[1]:= 1:
%p for n from 2 to N do
%p g:= igcd(V[n-1],n);
%p if g > 1 then V[n]:= V[n-1]/g else V[n]:= 3*V[n-1]+n+1 fi
%p od:
%p convert(V,list); # _Robert Israel_, Jun 22 2020
%t a[1] = 1; a[n_] := a[n] = If[(g = GCD[a[n-1], n]) > 1, a[n-1]/g, 3*a[n-1] + n + 1]; Array[a, 100].
%t nxt[{n_,a_}]:=With[{c=GCD[a,n+1]},{n+1,If[c>1,a/c,3a+n+2]}]; NestList[nxt,{1,1},70][[;;,2]] (* _Harvey P. Dale_, May 14 2024 *)
%o (PARI) lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, my(g = gcd(va[n-1], n)); if (g > 1, va[n] = va[n-1]/g, va[n] = 3*va[n-1]+n+1);); va;} \\ _Michel Marcus_, May 17 2020
%o (Magma) a:=[1]; for n in [2..70] do if Gcd(a[n-1], n) eq 1 then Append(~a, 3* a[n-1]+n+1); else Append(~a, a[n-1] div Gcd(a[n-1], n)); end if; end for; a; // _Marius A. Burtea_, May 17 2020
%Y Cf. A133058.
%K nonn
%O 1,2
%A _Ctibor O. Zizka_, May 17 2020