%I #37 Jun 14 2022 01:35:12
%S 2,3,4,14,15,20,16,24,18,26,33,5,7,6,10,21,12,8,94,9,124,27,25,38,30,
%T 62,32,11,35,28,36,40,39,45,42,48,44,54,46,57,86,49,74,51,13,50,22,55,
%U 56,60,63,64,75,65,80,66,90,70,96,68,69,92,84,105,85,112,87,106,72,152
%N Lexicographically earliest infinite sequence of distinct positive integers such that A(a(n+1)) is prime to A(a(n)) but not to A(a(n-1)), where A is A001414.
%C 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.
%C 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.
%C Similar to the Yellowstone sequence (A098550) in terms of coprime relations.
%C The first seven primes are in natural order but then we have ...,17,23,19,31,37,43,41,47,29,...
%C Conjectured to be a permutation of N/{0,1}.
%e 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.
%o (PARI) f(n) = my(f=factor(n)); f[, 1]~*f[, 2]; \\ A001414
%o 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
%Y Cf. A098440, A001414, A056240, A277272.
%K nonn,more
%O 1,1
%A _David James Sycamore_, Jun 11 2022
%E Corrected and extended by _Michel Marcus_, Jun 12 2022