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.

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

This page as a plain text file.
%I A110080 #19 Sep 02 2014 06:34:54
%S A110080 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 A110080 183,81,188,77,193,73,198,57,203,50,206,38,209,28,216,22,223,12,226,
%U A110080 417,222,422,219,435,202,440,199,445,190,448,177,455,169,462,166,469,161,472
%N 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).
%C A110080 If we did not skip earlier occurring integers when counting, we would instead have Cald's sequence (A006509).
%H A110080 Reinhard Zumkeller, <a href="/A110080/b110080.txt">Table of n, a(n) for n = 1..10000</a>
%e A110080 The first 5 terms of the sequence can be plotted on the number line as:
%e A110080 1,2,3,*,*,6,*,*,*,*,11,*,*,*,*,*.
%e A110080 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 A110080 Here is the calculation of the first 6 terms in more detail:
%e A110080 integers i : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...
%e A110080 i at n = ... : 1 5 2 . . 3 . . . .. .4 .. .. .. .. .6 ...
%e A110080 prime p used : - 7 2 . . 3 . . . .. .5 .. .. .. .. 11 ...
%o A110080 (Haskell)
%o A110080 import Data.Set (singleton, member, insert)
%o A110080 a110080 n = a110080_list !! (n-1)
%o A110080 a110080_list = 1 : f 1 a000040_list (singleton 1) where
%o A110080    f x (p:ps) m = y : f y ps (insert y m) where
%o A110080      y = g x p
%o A110080      g 0 _ = h x p
%o A110080      g u 0 = u
%o A110080      g u v = g (u - 1) (if member (u - 1) m then v else v - 1)
%o A110080      h u 0 = u
%o A110080      h u v = h (u + 1) (if member (u + 1) m then v else v - 1)
%o A110080 -- _Reinhard Zumkeller_, Sep 02 2014
%Y A110080 Cf. A091023, A091263, A006509, A111187 (inverse).
%K A110080 nonn,nice
%O A110080 1,2
%A A110080 _Leroy Quet_, Oct 12 2005
%E A110080 More terms from _Klaus Brockhaus_ and _Hans Havermann_, Oct 17 2005