

A110080


a(1) = 1; skipping over integers occurring earlier in the sequence, count down p(n) (p(n) = nth prime) from a(n) to get a(n+1). If this is <= 0, instead count up from a(n) p(n) positions (skipping already occurring integers) to get a(n+1).


5



1, 3, 6, 11, 2, 16, 29, 10, 32, 4, 39, 70, 31, 75, 27, 80, 20, 87, 17, 94, 9, 97, 176, 91, 183, 81, 188, 77, 193, 73, 198, 57, 203, 50, 206, 38, 209, 28, 216, 22, 223, 12, 226, 417, 222, 422, 219, 435, 202, 440, 199, 445, 190, 448, 177, 455, 169, 462, 166, 469, 161, 472
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

If we did not skip earlier occurring integers when counting, we would instead have Cald's sequence (A006509).


LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..10000


EXAMPLE

The first 5 terms of the sequence can be plotted on the number line as:
1,2,3,*,*,6,*,*,*,*,11,*,*,*,*,*.
a(5) is 2. Counting p(5) = 11 down from 2 gets a negative integer. So we instead count up 11 positions, skipping the 3, 6 and 11 as we count, to arrive at 16 (which is at the rightmost * of the number line above).
Here is the calculation of the first 6 terms in more detail:
integers i : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...
i at n = ... : 1 5 2 . . 3 . . . .. .4 .. .. .. .. .6 ...
prime p used :  7 2 . . 3 . . . .. .5 .. .. .. .. 11 ...


PROG

(Haskell)
import Data.Set (singleton, member, insert)
a110080 n = a110080_list !! (n1)
a110080_list = 1 : f 1 a000040_list (singleton 1) where
f x (p:ps) m = y : f y ps (insert y m) where
y = g x p
g 0 _ = h x p
g u 0 = u
g u v = g (u  1) (if member (u  1) m then v else v  1)
h u 0 = u
h u v = h (u + 1) (if member (u + 1) m then v else v  1)
 Reinhard Zumkeller, Sep 02 2014


CROSSREFS

Cf. A091023, A091263, A006509, A111187 (inverse).
Sequence in context: A137941 A077170 A083462 * A304086 A293666 A093903
Adjacent sequences: A110077 A110078 A110079 * A110081 A110082 A110083


KEYWORD

nonn,nice


AUTHOR

Leroy Quet, Oct 12 2005


EXTENSIONS

More terms from Klaus Brockhaus and Hans Havermann, Oct 17 2005


STATUS

approved



