login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A110080 a(1) = 1; skipping over integers occurring earlier in the sequence, count down p(n) (p(n) = n-th 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

%I #19 Sep 02 2014 06:34:54

%S 1,3,6,11,2,16,29,10,32,4,39,70,31,75,27,80,20,87,17,94,9,97,176,91,

%T 183,81,188,77,193,73,198,57,203,50,206,38,209,28,216,22,223,12,226,

%U 417,222,422,219,435,202,440,199,445,190,448,177,455,169,462,166,469,161,472

%N a(1) = 1; skipping over integers occurring earlier in the sequence, count down p(n) (p(n) = n-th 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).

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

%H Reinhard Zumkeller, <a href="/A110080/b110080.txt">Table of n, a(n) for n = 1..10000</a>

%e The first 5 terms of the sequence can be plotted on the number line as:

%e 1,2,3,*,*,6,*,*,*,*,11,*,*,*,*,*.

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

%e Here is the calculation of the first 6 terms in more detail:

%e integers i : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...

%e i at n = ... : 1 5 2 . . 3 . . . .. .4 .. .. .. .. .6 ...

%e prime p used : - 7 2 . . 3 . . . .. .5 .. .. .. .. 11 ...

%o (Haskell)

%o import Data.Set (singleton, member, insert)

%o a110080 n = a110080_list !! (n-1)

%o a110080_list = 1 : f 1 a000040_list (singleton 1) where

%o f x (p:ps) m = y : f y ps (insert y m) where

%o y = g x p

%o g 0 _ = h x p

%o g u 0 = u

%o g u v = g (u - 1) (if member (u - 1) m then v else v - 1)

%o h u 0 = u

%o h u v = h (u + 1) (if member (u + 1) m then v else v - 1)

%o -- _Reinhard Zumkeller_, Sep 02 2014

%Y Cf. A091023, A091263, A006509, A111187 (inverse).

%K nonn,nice

%O 1,2

%A _Leroy Quet_, Oct 12 2005

%E More terms from _Klaus Brockhaus_ and _Hans Havermann_, Oct 17 2005

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 19:02 EDT 2024. Contains 371798 sequences. (Running on oeis4.)