A143691 Lexicographically earliest permutation of the natural numbers having alternating even and odd numbers of prime factors.
1, 2, 4, 3, 6, 5, 9, 7, 10, 8, 14, 11, 15, 12, 16, 13, 21, 17, 22, 18, 24, 19, 25, 20, 26, 23, 33, 27, 34, 28, 35, 29, 36, 30, 38, 31, 39, 32, 40, 37, 46, 41, 49, 42, 51, 43, 54, 44, 55, 45, 56, 47, 57, 48, 58, 50, 60, 52, 62, 53, 64, 59, 65, 61, 69, 63, 74, 66, 77, 67, 81, 68
Offset: 1
Keywords
Links
Programs
-
Haskell
import Data.List (delete) a143691 n = a143691_list !! (n-1) a143691_list = f 1 [1..] where f m xs = g xs where g (z:zs) = if m + m' /= 1 then g zs else z : f m' (delete z xs) where m' = a001222 z `mod` 2 -- Reinhard Zumkeller, Aug 07 2014
Comments