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.

Showing 1-2 of 2 results.

A249054 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, unless a(n) is required to be prime by (ii), in which case a(n) is the smallest unused prime.

Original entry on oeis.org

1, 2, 4, 3, 6, 8, 5, 9, 10, 12, 7, 11, 14, 13, 15, 16, 17, 19, 23, 18, 20, 29, 31, 21, 22, 24, 37, 25, 26, 41, 27, 43, 28, 47, 30, 32, 53, 59, 33, 34, 61, 67, 35, 36, 71, 38, 73, 39, 40, 79, 83, 42, 89, 97, 101, 44, 45, 103, 46, 48, 107, 49, 50, 109, 113, 51
Offset: 1

Views

Author

N. J. A. Sloane, Nov 01 2014

Keywords

Comments

In contrast to A249053, here all the primes appear and in the correct order, and all the composites appear, also in increasing order. The graph shows two distinct curves. In A249053 many terms are missing, and the points lie on a single curve.
A permutation of the positive integers with inverse A249571.

Examples

			a(7) = 5, so a(7+a(7)) = a(7+5) = a(12) = 11 must be prime, which it is.
		

References

  • Gabriel Cunningham, Posting to Sequence Fans Mailing List, Mar 17 2008.

Crossrefs

See A249053 for another version.
Cf. A000040, A002808, A249571 (inverse).
Positions of primes and nonprimes: A249594 and A249595.

Programs

  • Haskell
    import Data.Map (singleton, findMin, delete, insert)
    a249054 n = a249054_list !! (n-1)
    a249054_list = 1 : f 1 a000040_list a002808_list (singleton 1 1) where
       f x ps'@(p:ps) cs'@(c:cs) m
         | k == x    = p : f (x + 1) ps cs' (insert (x + p) 0 $ delete x m)
         | otherwise = c : f (x + 1) ps' cs (insert (x + c) 0 m)
         where (k,_) = findMin m
    -- Reinhard Zumkeller, Nov 01 2014

Extensions

Data corrected by Reinhard Zumkeller, Nov 01 2014

A249594 Positions of primes in A249054.

Original entry on oeis.org

2, 4, 7, 11, 12, 14, 17, 18, 19, 22, 23, 27, 30, 32, 34, 37, 38, 41, 42, 45, 47, 50, 51, 53, 54, 55, 58, 61, 64, 65, 68, 71, 72, 74, 75, 78, 80, 81, 84, 87, 89, 90, 94, 97, 100, 102, 105, 108, 109, 111, 113, 116, 117, 119, 120, 123, 125, 129, 133, 134, 135
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 03 2014

Keywords

Comments

A249054(a(n)) = A000040(n); sequence is strictly increasing, i.e. all primes occur in A249054 in natural order, see also A249595.

Crossrefs

Cf. A000040, A026233, A049084, A239968, A249054, A249595 (complement).

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a249594 = (+ 1) . fromJust . (`elemIndex` a249054_list) . a000040
Showing 1-2 of 2 results.