OFFSET
1,1
COMMENTS
2,3,4 is the earliest string of three consecutive numbers which satisfy the definition, therefore the sequence begins a(1)=2, a(2)=3, a(3)=4.
Sequence is infinite since there always exists a k which has not occurred before such that A(k) is prime to A(a(n)) but not to A(a(n-1). Since A001414 covers N/{1} a number m can be found such that A(m)=k. Thus k can be chosen for a(n+1) unless there is a smaller number with the same property.
Similar to the Yellowstone sequence (A098550) in terms of coprime relations.
The first seven primes are in natural order but then we have ...,17,23,19,31,37,43,41,47,29,...
Conjectured to be a permutation of N/{0,1}.
EXAMPLE
a(4)=14 because A(14)=9 is prime to A(a(3))=4 but not to A(a(2))=3, and is the smallest number not already seen in the sequence which has this property.
PROG
(PARI) f(n) = my(f=factor(n)); f[, 1]~*f[, 2]; \\ A001414
lista(nn) = {my(va = vector(nn)); va[1] = 2; va[2] = 3; for (n=3, nn, my(k=1); while ((gcd(f(va[n-1]), f(k)) != 1) || (gcd(f(va[n-2]), f(k)) == 1) || #select(x->(x==k), va), k++); va[n] = k; ); va; } \\ Michel Marcus, Jun 12 2022
CROSSREFS
KEYWORD
nonn,more
AUTHOR
David James Sycamore, Jun 11 2022
EXTENSIONS
Corrected and extended by Michel Marcus, Jun 12 2022
STATUS
approved