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

A156031 Alternate A022941 and A143344.

Original entry on oeis.org

1, 2, 3, 5, 4, 9, 6, 15, 7, 22, 8, 30, 10, 40, 11, 51, 12, 63, 13, 76, 14, 90, 16, 106, 17, 123, 18, 141, 19, 160, 20, 180, 21, 201, 23, 224, 24, 248, 25, 273, 26, 299, 27, 326, 28, 354, 29, 383, 31, 414, 32, 446, 33, 479, 34, 513, 35, 548, 36, 584, 37, 621, 38, 659, 39, 698
Offset: 1

Views

Author

N. J. A. Sloane, Nov 01 2009, based on a posting by Eric Angelini to the Sequence Fans Mailing List

Keywords

Comments

Eric Angelini's definition was: start with 1,2,3; then alternately adjoin either the sum of the last two terms or the smallest number not yet in the sequence.

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a156031 n = a156031_list !! n
    a156031_list = tail $ concat (transpose [a022941_list, a143344_list])
    -- Reinhard Zumkeller, May 17 2013
  • PARI
    f="b156031.txt"; used=[]; write(f,c=1," ",b=1);a=1; for(i=1,1e3, used=setunion(used,Set(a+=b)); while(setsearch(used,b++), used=setminus(used,Set(b))); write(f,c++," "a"\n",c++," "b)) \\ M. F. Hasler, Nov 01 2009
    

A167151 a(2n+1) = a(2n) + a(2n-1), a(2n)=least number not yet in the sequence, a(1)=1.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 5, 12, 6, 18, 8, 26, 9, 35, 10, 45, 11, 56, 13, 69, 14, 83, 15, 98, 16, 114, 17, 131, 19, 150, 20, 170, 21, 191, 22, 213, 23, 236, 24, 260, 25, 285, 27, 312, 28, 340, 29, 369, 30, 399, 31, 430, 32, 462, 33, 495, 34, 529, 36, 565, 37, 602, 38, 640, 39, 679
Offset: 0

Views

Author

M. F. Hasler, Nov 01 2009

Keywords

Comments

Lexicographically earliest reordering of the nonnegative integers (can be extended by symmetry to a permutation of all integers) such that a(2n+1) = a(2n) + a(2n-1).

Crossrefs

Cf. A225850 (inverse).

Programs

  • Haskell
    import Data.List (transpose)
    a167151 n = a167151_list !! n
    a167151_list = 0 : concat (transpose [a005228_list, a030124_list])
    -- Reinhard Zumkeller, May 17 2013
  • Mathematica
    a[0] = 0; a[1] = 1;
    a[n_?OddQ] := a[n] = a[n - 1] + a[n - 2];
    a[n_?EvenQ] := a[n] = For[k = 2, True, k++,
         If[FreeQ[Array[a, n - 1], k], Return[k]]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Dec 02 2021 *)
  • PARI
    {used=[]; print1(b=0); a=1; for(i=1,99, used=setunion(used,Set(a+=b)); while(setsearch(used,b++), used=setminus(used,Set(b))); print1(", "a", "b))}
    

Formula

a(2n-1) = A005228(n); a(2n) = A030124(n).

A022941 a(n) = a(n-1) + c(n-2) for n >= 3, a( ) increasing, given a(1)=1, a(2)=2; where c( ) is complement of a( ).

Original entry on oeis.org

1, 2, 5, 9, 15, 22, 30, 40, 51, 63, 76, 90, 106, 123, 141, 160, 180, 201, 224, 248, 273, 299, 326, 354, 383, 414, 446, 479, 513, 548, 584, 621, 659, 698, 739, 781, 824, 868, 913, 959, 1006, 1054, 1103, 1153, 1205, 1258, 1312, 1367, 1423, 1480, 1538
Offset: 1

Views

Author

Keywords

Comments

Except for a(2), identical to A022940. - Ivan Neretin, Apr 05 2016

Crossrefs

Cf. A143344 (first differences), A156031.
Cf. A005228 and references therein.

Programs

  • Haskell
    import Data.List (delete)
    a022941 n = a022941_list !! (n-1)
    a022941_list = 1 : 2 : f 2 [3..] where
       f x (z:zs) = y : f y (delete y zs) where y = x + z
    -- Reinhard Zumkeller, May 17 2013
  • Maple
    a[1]:=1: a[2]:=2: c[1]:=3: for n from 2 to 70 do c[n]:=c[n-1]+1: for k from 1 to n do if(c[n]<=a[k])then if(c[n]=a[k])then c[n]:=c[n]+1: fi: break: fi: od: a[n+1]:=a[n]+c[n-1]: od: seq(a[n],n=1..70); # Nathaniel Johnston, May 01 2011
  • Mathematica
    Fold[Append[#1, #1[[-1]] + Complement[Range[Max@#1 + 1], #1][[#2]]] &, {1, 2}, Range[50]] (* Ivan Neretin, Apr 04 2016 *)

Extensions

a(27) inserted by Nathaniel Johnston, May 01 2011
Showing 1-3 of 3 results.