cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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).

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Nov 01 2014

Keywords

References

  • Eric Angelini, Posting to Sequence Fans Mailing List, Mar 17 2008 (the definition was clarified by Gabriel Cunningham).

Crossrefs

See A249054 for another version.

Programs

  • 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