%I #11 Sep 27 2015 11:29:06
%S 1,2,3,4,5,7,11,9,8,13,17,19,15,14,23,29,31,25,6,37,41,43,35,12,47,53,
%T 59,49,10,27,61,67,71,16,21,55,73,79,26,51,77,83,89,20,39,97,101,103,
%U 22,45,91,107,109,32,33,65,113,119,38,69,121,125,127,28,57,131,85,137,44,63,139,95,149,34,81,143,115,133,58
%N Lexicographically earliest sequence such that a(n) is coprime to the preceding 4 terms and does not occur earlier; a(n) = n for n=1,2,3,4.
%C One possible generalization of A084937 resp. A103683 to N=4, cf. A143345 for a different version.
%o (PARI) N=99; print1("1, 2, 3"); a=[1, 2, 3, L=4]; unused=[]; v=vector(#a, i, 1); for(n=#a, N, print1(", "a[#a]); for(i=1, #unused, apply(x->gcd(x, unused[i]), a)==v || next; a=concat(vecextract(a, "^1"), unused[i]); unused=vecextract(unused, Str("^", i)); next(2)); L++; while(apply(x->gcd(x, L), a) !=v, unused=concat(unused, L++-1); ); a=concat(vecextract(a, "^1"), L))
%K nonn
%O 1,2
%A _M. F. Hasler_, Jan 18 2011