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.

A358534 Start with a(1)=1, a(2)=2. Thereafter, if gcd(a(n-2),a(n-1)) = 1 then a(n) is the smallest unused k such that gcd(a(n-2),k) > 1 and gcd(a(n-1),k) = 1, otherwise a(n) is the smallest unused k such that gcd(a(n-2),k) = 1 and gcd(a(n-1),k) > 1. If the latter is impossible, then a(n) = smallest missing number u. (See comments.)

Original entry on oeis.org

1, 2, 4, 3, 9, 5, 10, 6, 25, 35, 7, 15, 12, 55, 11, 20, 8, 45, 21, 40, 16, 65, 13, 30, 14, 27, 33, 17, 34, 18, 85, 95, 51, 24, 119, 49, 68, 22, 153, 39, 136, 28, 187, 99, 170, 26, 75, 57, 50, 32, 105, 63, 80, 38, 115, 23, 60, 36, 125, 145, 19, 76, 29, 87, 31, 62
Offset: 1

Views

Author

Keywords

Comments

A lexicographically earliest sequence. We write (i,j) to mean gcd(i,j) for brevity. Let rad(m) = A007947(m).
Define (i,j)=1 to be "closed" else "open". If we have i and j closed, then we find the least k not already in the sequence that is closed to i but open to j, otherwise we find same that is open to i but closed to j.
Condition [1], (i,j)=1 requires smallest unused k such that (i,k)=1 and (j,k)>1, given primes p|i, merely by finding the smallest missing k indivisible by any p.
Condition [2], (i,j)>1, requires smallest unused k such that (i,k)>1 and (j,k)=1 iff rad(i) does not divide rad(j).
Let S = {p | i} and T = {q | j}. If T contains S, then (j,k)=1 makes (i,k)>1 impossible.
Condition [3] allows a solution. In this case, we simply set a(n) = u, the smallest missing number in a(1..n-1).
The most conspicuous case of [3] is i = p^v and j = p^w, v < w. Since p^v | p^w, if a(n) = k is made such that (p^w,k)=1, then k is also coprime to p^v or any power of p. Hence we write a(n) = u.
Another, rare case of [3] is if i and j belong to R, the sequence of numbers that are products of the same squarefree kernel K. Suppose K = 6, then R = A003586. Now suppose i = 6*R(2) = 6*2 = 12 and j = 6*R(3) = 6*3 = 18. Indeed, if a(n) = k is made such that (18,k)=1, then k is also coprime to 12 and any number in 6*R. Hence in this case we write a(n) = u.

Crossrefs

Cf. A358093.

Programs

  • Mathematica
    nn = 120; c[] = False; q[] = 1; f[n_] := Times @@ FactorInteger[n][[All, 1]]; Array[Set[{a[#], c[#]}, {#, True}] &, 2]; Set[{i, j, u}, {a[1], a[2], 3}]; Set[{r, s}, {f[i], f[j]}]; Do[Which[CoprimeQ[i, j], If[PrimeNu[j] == 1, While[c[q[s] s], q[s]++]; k = q[s]; While[Nand[! c[s k], CoprimeQ[i, k]], k++]; k *= s, k = u; While[Nand[! c[k], CoprimeQ[i, k], ! CoprimeQ[j, k]], k++]], Divisible[s, r], k = u, True, If[PrimeNu[i] == 1, While[c[q[r] s], q[r]++]; k = q[r]; While[Nand[! c[r k], CoprimeQ[j, k]], k++]; k *= r, k = u; While[Nand[! c[k], ! CoprimeQ[i, k], CoprimeQ[j, k]], k++]] ]; Set[{a[n], c[k], i, j, r, s}, {k, True, j, k, s, f[k]}]; If[k == u, While[c[u], u++]], {n, 3, nn}]; Array[a, nn]