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-4 of 4 results.

A072009 Inverse of permutation A072007.

Original entry on oeis.org

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

Views

Author

Clark Kimberling, Jun 07 2002

Keywords

Crossrefs

Cf. A072007.

A072008 a(n)=b(3n+1), where b=A072007.

Original entry on oeis.org

2, 4, 5, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20, 23, 24, 25, 27, 29, 31, 32, 33, 35, 36, 38, 39, 41, 42, 43, 46, 47, 48, 50, 52, 54, 55, 56, 59, 60, 62, 63, 64, 65, 66, 69, 70, 72, 73, 74, 77, 78, 79, 81, 83, 84, 86, 87, 88, 91, 92, 93, 95
Offset: 1

Views

Author

Clark Kimberling, Jun 07 2002

Keywords

Crossrefs

Cf. A072007.

A081145 a(1)=1; thereafter, a(n) is the least positive integer which has not already occurred and is such that |a(n)-a(n-1)| is different from any |a(k)-a(k-1)| which has already occurred.

Original entry on oeis.org

1, 2, 4, 7, 3, 8, 14, 5, 12, 20, 6, 16, 27, 9, 21, 34, 10, 25, 41, 11, 28, 47, 13, 33, 54, 15, 37, 60, 17, 42, 68, 18, 45, 73, 19, 48, 79, 22, 55, 23, 58, 94, 24, 61, 99, 26, 66, 107, 29, 71, 115, 30, 75, 121, 31, 78, 126, 32, 81, 132, 35, 87, 140, 36, 91, 147, 38, 96, 155, 39
Offset: 1

Views

Author

Don Reble, Mar 08 2003

Keywords

Comments

The sequence is a permutation of the positive integers. The inverse is A081146.
Similar to A100707, except that when we subtract we use the largest possible k.
The 1977 paper of Slater and Velez proves that this sequence is a permutation of positive integers and conjectures that its absolute difference sequence (see A308007) is also a permutation. If we call this the "Slater-Velez permutation of the first kind", then they also constructed another permutation (the 2nd kind), for which they are able to prove that both the sequence (A129198) and its absolute difference (A129199) are true permutations. - Ferenc Adorjan, Apr 03 2007
The points appear to lie on three straight lines of slopes roughly 0.56, 1.40, 2.24 (click "graph", or see the Wilks link). I checked this for the first 10^6 terms using Allan Wilks's C program. See A308009-A308015 for further information about the three lines. - N. J. A. Sloane, May 14 2019

Examples

			a(4)=7 because the previous term is 4 and the differences |3-4|, |5-4| and |6-4| have already occurred.
After 7 we get 3 as the difference 4 has not occurred earlier. 5 follows 14 as the difference 9 has not occurred earlier.
		

Crossrefs

The sequence of differences is A099004 (see also A308007).
Similar to Murthy's sequence A093903, Cald's sequence (A006509) and Recamán's sequence A005132. See also A100707 (another version).
A308021 is an offspring of this sequence. - N. J. A. Sloane, May 13 2019
See A308009-A308015 for the lines that the points lie on.
A308172 gives smallest missing numbers.

Programs

  • Haskell
    import Data.List (delete)
    a081145 n = a081145_list !! (n-1)
    a081145_list = 1 : f 1 [2..] [] where
       f x vs ws = g vs where
         g (y:ys) = if z `elem` ws then g ys else y : f y (delete y vs) (z:ws)
                    where z = abs (x - y)
    -- Reinhard Zumkeller, Jul 02 2015
  • Mathematica
    f[s_] := Block[{d = Abs[Rest@s - Most@s], k = 1}, While[ MemberQ[d, Abs[k - Last@s]] || MemberQ[s, k], k++ ]; Append[s, k]]; NestList[s, {1}, 70] (* Robert G. Wilson v, Jun 09 2006 *)
    f[s_] := Block[{k = 1, d = Abs[Most@s - Rest@s], l = Last@s}, While[MemberQ[s, k] || MemberQ[d, Abs[l - k]], k++ ]; Append[s, k]]; Nest[f, {1}, 70] (* Robert G. Wilson v, Jun 13 2006 *)
  • PARI
    {SV_p1(n)=local(x,v=6,d=2,j,k); /* Slater-Velez permutation - the first kind (by F. Adorjan)*/ x=vector(n);x[1]=1;x[2]=2; for(i=3,n,j=3;k=1;while(k,if(k=bittest(v,j)||bittest(d,abs(j-x[i-1])),j++,v+=2^j;d+=2^abs(j-x[i-1]);x[i]=j))); return(x)} \\ Ferenc Adorjan, Apr 03 2007
    
  • Python
    A081145_list, l, s, b1, b2 = [1,2], 2, 3, set(), set([1])
    for n in range(3, 10**2):
        i = s
        while True:
            m = abs(i-l)
            if not (i in b1 or m in b2):
                A081145_list.append(i)
                b1.add(i)
                b2.add(m)
                l = i
                while s in b1:
                    b1.remove(s)
                    s += 1
                break
            i += 1 # Chai Wah Wu, Dec 15 2014
    

A078783 a(0) = 0; a(1)=1; for n>1, a(n) = least positive integer m not among a(1),...,a(n-1) such that |m-a(n-1)| > |a(n-1)-a(n-2)|.

Original entry on oeis.org

0, 1, 3, 6, 2, 7, 13, 4, 14, 25, 5, 26, 48, 8, 49, 91, 9, 92, 176, 10, 177, 345, 11, 346, 682, 12, 683, 1355, 15, 1356, 2698, 16, 2699, 5383, 17, 5384, 10752, 18, 10753, 21489, 19, 21490, 42962, 20, 42963, 85907, 21, 85908, 171796, 22, 171797
Offset: 0

Views

Author

Reiner Martin, Jan 09 2003

Keywords

Comments

This is a permutation pi of the nonnegative integers such that |pi(n+1)-pi(n)| is strictly increasing. In other words, it is a walk on the nonnegative numbers with strictly increasing step size which visits every number exactly once.
A greedy version of Recamán's sequence: Construct two sequences a() and d() as follows. a(0)=0, a(1)=1, a(2)=3, d(0)=0, d(1)=1, d(2)=2. For n>=3, let m be smallest nonnegative number not yet in the a sequence. Let i = a(n-1)-m. If i > d(n), then a(n) = a(n-1)-i = m, d(n) = i; otherwise a(n) = a(n-1)+d(n-1)+1, d(n) = d(n-1)+1. Has the properties that a() is the Recamán transform of d() and every number appears in a(). This sequence is a(), while d() is A117073. Has a natural decompostion into segments of length 3. - N. J. A. Sloane, Apr 16 2006
For n>0: a(3*n-2)=A117070(n), a(3*n-1)=A117071(n) and a(3*n)=A117072(n).

References

  • N. J. A. Sloane and Allan Wilks, On sequences of Recaman type, paper in preparation, 2006.

Crossrefs

Cf. A257502 (inverse).

Programs

  • Haskell
    import Data.List (delete)
    a078783 n = a078783_list !! n
    (a078783_list, a117073_list) = unzip $
       (0,0) : (1,1) : (3,2) : f 3 2 (2:[4..]) where
       f a d ms@(m:_) = (a', d') : f a' d' (delete a' ms) where
         (a', d') = if i > d then (m, i) else (a + d + 1, d + 1)
         i = a - m
    -- Reinhard Zumkeller, May 01 2015
  • Mathematica
    a[0] = 0; a[1] = 1;
    a[n_] := a[n] = For[m = 2, True, m++, If[FreeQ[Array[a, n-1], m], If[Abs[m - a[n-1]] > Abs[a[n-1] - a[n-2]], Return[m]]]];
    Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Aug 02 2018 *)
Showing 1-4 of 4 results.