OFFSET
1,2
COMMENTS
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.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
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, ...
MAPLE
N:= 100: # for a(1)..a(N)
V:= Vector(N):
V[1]:= 1:
for n from 2 to N do
g:= igcd(V[n-1], n);
if g > 1 then V[n]:= V[n-1]/g else V[n]:= 3*V[n-1]+n+1 fi
od:
convert(V, list); # Robert Israel, Jun 22 2020
MATHEMATICA
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].
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 *)
PROG
(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
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Ctibor O. Zizka, May 17 2020
STATUS
approved