cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A334943 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.

Original entry on oeis.org

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, 204, 68, 17, 81, 27, 113, 372, 124, 62, 222, 37, 1, 42, 14, 7, 63, 3, 53, 204, 68, 34, 150, 25, 125, 5, 67, 254, 816, 136, 464, 58, 232, 4, 72, 6, 80, 40, 184, 23, 135
Offset: 1

Views

Author

Ctibor O. Zizka, May 17 2020

Keywords

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.

Examples

			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, ...
		

Crossrefs

Cf. A133058.

Programs

  • 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
  • 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 *)
  • 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