login
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.
8
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, 47, 65, 18, 53, 20, 57, 83, 22, 61, 27, 55, 79, 24, 67, 26, 71, 33, 73, 43, 75, 119, 30, 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
OFFSET
1,2
COMMENTS
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.
See A354731 for the differences between terms.
LINKS
Michael De Vlieger, Annotated log log scatterplot of a(n), n = 1..2^14, showing records in red and local minima in blue, highlighting primes in green and fixed points in gold.
Scott R. Shannon, Image of the first 10000 terms. The green line is y = n.
EXAMPLE
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.
MATHEMATICA
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 *)
PROG
(Python)
from math import gcd
from sympy import isprime, nextprime
from itertools import count, islice
def agen(): # generator of terms
aset, diffset, an, mink = {1}, set(), 1, 2
yield 1
for n in count(2):
k = mink
while k in aset or abs(an-k) in diffset or gcd(an, k) != 1: k += 1
aset.add(k); diffset.add(abs(k-an)); an = k; yield an
while mink in aset: mink += 1
print(list(islice(agen(), 74))) # Michael S. Branicky, Jun 04 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Jun 03 2022
STATUS
approved