Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A249053
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).
2
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, 44, 45, 47, 48, 53, 54, 55, 59, 60, 62, 63, 67, 68, 71, 72, 73, 74, 79, 80, 81, 82, 83, 84, 89, 90, 97, 98, 101, 102, 104, 105, 106, 108, 109, 110, 113, 114, 115
OFFSET
1,2
REFERENCES
Eric Angelini, Posting to Sequence Fans Mailing List, Mar 17 2008 (the definition was clarified by Gabriel Cunningham).
LINKS
PROG
(Haskell)
import Data.Map (singleton, findMin, delete, insert)
a249053 n = a249053_list !! (n-1)
a249053_list = 1 : f 1 1 a002808_list (singleton 1 1) where
f x z cs m
| k == x = p : f (x + 1) p cs (insert (x + p) 0 $ delete x m)
| otherwise = c : f (x + 1) c cs' (insert (x + c) 0 m)
where p = a007918 z
(c:cs') = dropWhile (<= z) cs
(k, _) = findMin m
-- Reinhard Zumkeller, Nov 01 2014
CROSSREFS
See A249054 for another version.
Sequence in context: A093080 A059916 A099747 * A082851 A091207 A284525
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Nov 01 2014
STATUS
approved