%I #14 Sep 29 2017 02:51:20
%S 1,2,6,3,10,4,12,5,14,7,15,8,18,9,20,11,21,13,22,16,24,17,26,19,28,23,
%T 30,25,33,27,34,29,35,31,36,32,38,37,39,41,40,42,43,44,47,45,49,46,53,
%U 48,59,50,60,51,61,52,64,54,66,55,67,56,70,57,71,58,73,62,78,63,79,65
%N a(1)=1; for n>1, a(n) = smallest positive integer not among the earlier terms of the sequence that is divisible by a different number of distinct primes than a(n-1).
%C Sequence is a permutation of the positive integers.
%H Reinhard Zumkeller, <a href="/A109465/b109465.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%e Of the positive integers (4,5,7,8,9,10,11,...) not among the first 4 terms of the sequence, 10 is the smallest which is divisible by a different number of distinct primes than a(4) = 3. So a(5) = 10.
%t a = {1}; Do[k = 2; While[Nand[FreeQ[a, k], PrimeNu[k] != PrimeNu[a[[i - 1]]]], k++]; AppendTo[a, k], {i, 2, 72}]; a (* _Michael De Vlieger_, Sep 28 2017 *)
%o (Haskell)
%o import Data.List (delete)
%o a109465 n = a109465_list !! (n-1)
%o a109465_list = f 1 [1..] where
%o f o xs = g xs where
%o g (z:zs) = if o' == o then g zs else z : f o' (delete z xs)
%o where o' = a001221 z
%o -- _Reinhard Zumkeller_, Aug 07 2014
%Y Cf. A001221.
%Y Cf. A241012 (inverse), A143691.
%K nonn
%O 1,2
%A _Leroy Quet_, Aug 28 2005
%E Extended by _Ray Chandler_, Aug 28 2005