OFFSET
1,2
COMMENTS
By definition, in contrast to A098550, in this sequence there is a priority for appearance of the primes.
LINKS
Peter J. C. Moses, Table of n, a(n) for n = 1..1000
David L. Applegate, Hans Havermann, Bob Selcoe, Vladimir Shevelev, N. J. A. Sloane, and Reinhard Zumkeller, The Yellowstone Permutation, arXiv preprint arXiv:1501.01669 [math.NT], 2015.
MATHEMATICA
a[n_] := a[n] = If[n <= 3, n, Module[{p = FactorInteger[a[n-2]][[-1, 1]], aa = Array[a, n-1], x}, If[FreeQ[aa, p], Return[p], For[x = 4, True, x++, If[FreeQ[aa, x] && GCD[x, a[n-2]]>1 && GCD[x, a[n-1]]==1, Return[x]]]]]];
Array[a, 100] (* Jean-François Alcover, Oct 06 2018 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Feb 24 2015
EXTENSIONS
More terms from Peter J. C. Moses, Feb 24 2015
STATUS
approved