%I #12 Aug 02 2019 19:24:30
%S 1,4,2,8,9,3,10,5,6,16,15,12,25,14,7,18,20,21,22,11,24,27,26,13,28,30,
%T 32,33,34,17,35,36,40,39,38,19,42,44,45,46,23,48,49,50,51,52,54,55,56,
%U 57,58,29,60,63,62,31,64,65,66,68,69,70,72,75,74,37,76,77,78,80,81,82
%N a(1)=1. a(n) is the smallest positive integer not occurring earlier in the sequence such that a(n)/gcd(a(n), a(n-1)) is not a prime.
%C Sequence is a permutation of the positive integers.
%e a(22) = 27 because 27 is the smallest positive integer not occurring among the first 21 terms of the sequence such that a(22)/gcd(a(22), a(21)) = 27/gcd(27, 24) = 9 is not a prime.
%e a(8) = 5 because 5 is the smallest positive integer not occurring among the first 7 terms of the sequence such that a(8)/gcd(a(8), a(7)) = 5/gcd(5, 10) = 1 is not a prime.
%t f[l_List] := Block[{k = 1},While[MemberQ[l, k] || PrimeQ[k/GCD[k, l[[ -1]]]], k++ ];Append[l, k]];Nest[f, {1}, 72] (* _Ray Chandler_, Feb 13 2007 *)
%K nonn
%O 1,2
%A _Leroy Quet_, Jan 09 2007
%E Extended by _Ray Chandler_, Feb 13 2007