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.

A256372 Fixed points of permutations A256210 and A256371.

Original entry on oeis.org

3, 6, 7, 122, 123, 226, 227, 506, 507, 794, 795, 970, 971, 3118, 3119, 11074, 11075, 14502, 14503, 55536, 55537, 77752, 77753, 77754, 77755, 85524, 85525, 90434, 90435, 101222, 101223, 101226, 101227, 101230, 101231, 207146, 207147, 227730, 227731, 244576, 244577, 244578
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 26 2015

Keywords

Crossrefs

Programs

  • Haskell
    a256372 n = a256372_list !! (n-1)
    a256372_list = [x | x <- [1..], a256210 x == x]

A256210 Lexicographically earliest permutation of positive integers starting with 2 such that a(a(n)+a(n+1)) is odd for all n.

Original entry on oeis.org

2, 1, 3, 5, 4, 6, 7, 9, 11, 13, 8, 10, 15, 12, 14, 17, 16, 19, 18, 21, 23, 20, 22, 25, 27, 29, 31, 24, 26, 28, 33, 30, 35, 32, 37, 34, 39, 36, 41, 38, 40, 43, 45, 47, 42, 44, 49, 46, 48, 51, 50, 53, 52, 55, 57, 59, 54, 56, 58, 61, 63, 60, 65, 62, 67, 64, 69
Offset: 1

Views

Author

N. J. A. Sloane, Mar 26 2015

Keywords

Comments

This is the sequence U defined in the comments on A255003.

Crossrefs

Cf. A255003.
Cf. A256371 (inverse), A256372 (fixed points).

Programs

  • Haskell
    after Robert Israel's Maple program
    import Data.IntSet (empty, member, insert)
    a256210 n = a256210_list !! (n-1)
    a256210_list = 2 : f [2 ..] 2 [1, 3 ..] [4, 6 ..] empty where
       f (x:xs) y us'@(u:us) vs'@(v:vs) s
         | member x s || u < v = u : f xs u us vs' (insert (y + u) s)
         | otherwise           = v : f xs v us' vs (insert (y + v) s)
    -- Reinhard Zumkeller, Mar 26 2015
  • Maple
    N:= 100: # to get a(n) for n <= N
    maxodd:= -1:
    maxeven:= 2:
    a[1]:= 2:
    needodd:= {}:
    for n from 2 to N do
      if member(n,needodd) or maxodd < maxeven then
         a[n]:= maxodd + 2;
         maxodd:= a[n];
      else
         a[n]:= maxeven + 2;
         maxeven:= a[n];
      fi;
      needodd:= needodd union {a[n-1]+a[n]};
    od:
    seq(a[n],n=1..N); # Robert Israel, Mar 26 2015
  • Mathematica
    nn = 100;
    maxodd = -1;
    maxeven = 2;
    a[1] = 2;
    needodd = {};
    For[n = 2, n <= nn, n++,
        If[MemberQ[needodd, n] || maxodd < maxeven,
           a[n] = maxodd + 2;
           maxodd = a[n]
       ,
           a[n] = maxeven + 2;
           maxeven = a[n]
       ];
        needodd = needodd ~Union~ {a[n-1]+a[n]};
    ];
    Array[a, nn] (* Jean-François Alcover, Aug 04 2018, after Robert Israel *)
Showing 1-2 of 2 results.