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.

A072007 a(0) = 0; for n>=1, a(n)=least nonnegative integer x such that |x-a(n-1)|>=n and x is not a(k) for any k

Original entry on oeis.org

0, 1, 3, 6, 2, 7, 13, 4, 12, 21, 5, 16, 28, 8, 22, 37, 9, 26, 44, 10, 30, 51, 11, 34, 58, 14, 40, 67, 15, 45, 75, 17, 49, 82, 18, 53, 89, 19, 57, 96, 20, 61, 103, 23, 68, 113, 24, 71, 119, 25, 76, 127, 27, 80, 134, 29, 85, 142, 31, 90, 150, 32
Offset: 0

Views

Author

Clark Kimberling, Jun 07 2002

Keywords

Comments

A permutation of the nonnegative integers.

Crossrefs

Cf. A072008, A072009 (inverse).

Programs

  • Haskell
    import Data.List (delete)
    a072007 n = a072007_list !! n
    a072007_list = 0 : f 1 0 [1..] where
       f u v ws = g ws where
         g (x:xs) = if abs (x - v) < u
                       then g xs else x : f (u + 1) x (delete x ws)
    -- Reinhard Zumkeller, Sep 04 2014

A167046 Angry numbers: each number n must be more than n places from n-1 and n+1. This sequence places each number as early as possible.

Original entry on oeis.org

1, 4, 7, 2, 10, 13, 16, 3, 5, 19, 22, 8, 25, 28, 31, 6, 11, 34, 37, 40, 14, 9, 43, 46, 17, 49, 52, 55, 58, 12, 20, 61, 64, 67, 23, 70, 15, 73, 76, 26, 79, 82, 85, 18, 29, 88, 91, 32, 94, 97, 100, 103, 21, 35, 106, 109, 112, 38, 115, 24, 118, 41, 121, 124, 127, 130, 133, 27
Offset: 1

Views

Author

Keywords

Comments

This sequence is a permutation of the positive integers. After any two increases in the position of n from after the first hole, it will be possible to put the next number in that hole.

Examples

			For a(n) = 2, n must be at least 3 away from a^{-1}(1) = 1, so n = 4. Next, a(n) = 3 must be 4 away from 4, so it can't be less than 4; hence a(8) = 3. Then a(n) = 4 must be 5 away from 8; the first hole at 2 is far enough, so a(2) = 4.
		

Crossrefs

Programs

  • PARI
    dist(n) = n+1
    al(n) = {local(d,v,w,mn,j);
    v=vector(n);w=vector(n);
    v[1]=w[1]=1;mn=2;
    for(k=2,n,
    d=dist(k);
    if(w[k-1]-d>=mn,
    j=mn;mn++;while(v[mn],mn++),
    j=w[k-1]+d;while(j<=#v&v[j],j++);if(j>#v,v=vector(j,i,if(i<=#v,v[i],0))));
    v[j]=k;w[k]=j);
    v}
Showing 1-2 of 2 results.