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.

A354688 a(1) = 1; for n > 1, a(n) is the smallest positive number that has not yet appeared that is coprime to a(n-1) and the difference | a(n) - a(n-1) | is distinct from all previous differences.

This page as a plain text file.
%I A354688 #21 Jun 04 2022 13:04:52
%S A354688 1,2,5,3,7,12,19,4,13,21,8,25,6,17,11,23,9,29,39,10,31,15,37,14,41,16,
%T A354688 47,65,18,53,20,57,83,22,61,27,55,79,24,67,26,71,33,73,43,75,119,30,
%U A354688 89,32,81,28,93,35,86,149,34,101,45,91,127,36,107,38,111,49,97,139,40,117,167,42,121,46
%N A354688 a(1) = 1; for n > 1, a(n) is the smallest positive number that has not yet appeared that is coprime to a(n-1) and the difference | a(n) - a(n-1) | is distinct from all previous differences.
%C A354688 All of the terms are concentrated along four lines - this is in contrast to A352588 where they all concentrated along one line. See the linked image. The primes do not occur in their natural order. The sequence is conjectured to be a permutation of the positive integers.
%C A354688 See A354731 for the differences between terms.
%H A354688 Michael De Vlieger, <a href="/A354688/b354688.txt">Table of n, a(n) for n = 1..10000</a>
%H A354688 Michael De Vlieger, <a href="/A354688/a354688_1.png">Annotated log log scatterplot of a(n)</a>, n = 1..2^14, showing records in red and local minima in blue, highlighting primes in green and fixed points in gold.
%H A354688 Scott R. Shannon, <a href="/A354688/a354688.png">Image of the first 10000 terms</a>. The green line is y = n.
%e A354688 a(6) = 12 as a(5) = 7, and 12 is the smallest unused number that is coprime to 7 and whose difference from the previous term, | 12 - 7 | = 5, has not appeared. Note that 4,6,8,9,10,11 are all coprime to 7 but their differences from 7 have all appeared as differences between previous terms so none can be chosen.
%t A354688 nn = 120; c[_] = d[_] = 0; a[1] = c[1] = 1; a[2] = c[2] = j = 2; u = 3; Do[Set[k, u]; While[Nand[c[k] == 0, d[Abs[k - j]] == 0, CoprimeQ[j, k]], k++]; Set[{a[i], c[k], d[Abs[k - j]]}, {k, i, i}]; j = k; If[k == u, While[c[u] > 0, u++]], {i, 3, nn}]; Array[a, nn] (* _Michael De Vlieger_, Jun 04 2022 *)
%o A354688 (Python)
%o A354688 from math import gcd
%o A354688 from sympy import isprime, nextprime
%o A354688 from itertools import count, islice
%o A354688 def agen(): # generator of terms
%o A354688     aset, diffset, an, mink = {1}, set(), 1, 2
%o A354688     yield 1
%o A354688     for n in count(2):
%o A354688         k = mink
%o A354688         while k in aset or abs(an-k) in diffset or gcd(an, k) != 1: k += 1
%o A354688         aset.add(k); diffset.add(abs(k-an)); an = k; yield an
%o A354688         while mink in aset: mink += 1
%o A354688 print(list(islice(agen(), 74))) # _Michael S. Branicky_, Jun 04 2022
%Y A354688 Cf. A354731, A352588, A093714, A354687, A354721.
%K A354688 nonn
%O A354688 1,2
%A A354688 _Scott R. Shannon_, Jun 03 2022