%I #11 Nov 01 2014 06:07:15
%S 1,2,4,5,6,8,11,12,13,14,17,18,20,23,24,25,26,29,30,31,32,37,38,41,42,
%T 44,45,47,48,53,54,55,59,60,62,63,67,68,71,72,73,74,79,80,81,82,83,84,
%U 89,90,97,98,101,102,104,105,106,108,109,110,113,114,115
%N Defined by (i) a(1)=1; (ii) if you move a(n) steps to the right you must reach a prime; (iii) a(n) = smallest unused composite number greater than a(n-1), unless a(n) is required to be prime by (ii), in which case a(n) is the smallest unused prime greater than a(n-1).
%D Eric Angelini, Posting to Sequence Fans Mailing List, Mar 17 2008 (the definition was clarified by Gabriel Cunningham).
%H Reinhard Zumkeller, <a href="/A249053/b249053.txt">Table of n, a(n) for n = 1..10000</a>
%o (Haskell)
%o import Data.Map (singleton, findMin, delete, insert)
%o a249053 n = a249053_list !! (n-1)
%o a249053_list = 1 : f 1 1 a002808_list (singleton 1 1) where
%o f x z cs m
%o | k == x = p : f (x + 1) p cs (insert (x + p) 0 $ delete x m)
%o | otherwise = c : f (x + 1) c cs' (insert (x + c) 0 m)
%o where p = a007918 z
%o (c:cs') = dropWhile (<= z) cs
%o (k,_) = findMin m
%o -- _Reinhard Zumkeller_, Nov 01 2014
%Y See A249054 for another version.
%Y Cf. A002808, A007918.
%K nonn
%O 1,2
%A _N. J. A. Sloane_, Nov 01 2014
|