%I #39 Apr 23 2015 09:58:19
%S 1,2,4,3,5,6,7,15,8,9,10,21,11,12,25,13,27,14,30,16,33,17,35,18,19,39,
%T 20,42,22,45,23,24,49,50,51,26,54,55,28,57,29,60,31,63,32,65,66,34,69,
%U 70,36,37,75,38,77,78,40,81,41,84,85,43,87,44,90,91,46,93,47,95,48,98,99
%N Smallest divisor of n-th composite number (A002808(n)) which has not occurred earlier in the sequence.
%C A permutation of the natural numbers. Subsidiary sequence: k :a(k) = k.
%C This sequence is a permutation of the positive integers. - _Leroy Quet_, Feb 03 2007
%H Diana L. Mecum and Michael De Vlieger, <a href="/A111269/b111269.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from Diana L. Mecum)
%e Smallest divisor of the n-th composite number not already in the sequence.
%e The 7th composite integer is 14. The divisors of 14 are 1,2,7,14. Of these, 1 and 2 occur among the first 6 terms of the sequence. So 7 is the lowest divisor of 14 which is missing from the first 6 terms of the sequence. Therefore a(7) = 7. - _Leroy Quet_, Feb 03 2007
%e The 13th composite number is 22. Its divisors are {1, 2, 11, 22}. 1 and 2 are already in the sequence. The smallest divisor of 22 which is not already in the sequence is 11. So a(13)=11. - _Diana L. Mecum_, Jan 03 2009
%p N:= 200: # to get up to a(m), where m is the number of composites <= N
%p Comps:= {$2..N} minus select(isprime,{2,seq(2*i+1,i=1..floor((N-1)/2))}):
%p S:= {}:
%p for n from 1 to nops(Comps) do
%p A[n]:= min(numtheory:-divisors(Comps[n]) minus S);
%p S:= S union {A[n]}
%p od:
%p seq(A[n],n=1..nops(Comps)); # _Robert Israel_, Apr 21 2015
%t f[l_List] := Block[{n = Length[l] + 1, c = 1, k = n}, While[k > 0, c++; While[PrimeQ[c], c++]; k--;]; Append[l, First[Select[Divisors[c], FreeQ[l, #] &]]]]; Nest[f, {}, 10000] (* _Ray Chandler_,Feb 07 2007 *)
%t CompositeList = Drop[Complement[Range[2741], Prime[Range[400]]], 1]; sequence = {1, 2, 4, 3}; Do[AppendTo[sequence, DeleteCases[Table[If[! MemberQ[sequence, Divisors[CompositeList[[n]]][[j]]], Divisors[CompositeList[[n]]][[j]],], {j, 1, Length[Divisors[CompositeList[[n]]]]}], Null][[1]]], {n, 5, 1000}]; sequence (* _Diana L. Mecum_, Jul 21 2012 *)
%Y Cf. A002808.
%K base,nonn
%O 1,2
%A _Amarnath Murthy_, Nov 11 2005
%E Added terms a(23) - a(999) - _Diana L. Mecum_, Jan 03 2009, corrected Jul 21 2012