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.

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

A143344 First differences of A022941.

Original entry on oeis.org

1, 3, 4, 6, 7, 8, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77
Offset: 1

Views

Author

N. J. A. Sloane, Nov 01 2009

Keywords

Comments

This is (essentially) the sequence c() mentioned in the definition of A022941.

Crossrefs

Programs

  • Haskell
    import Data.List (delete)
    a143344 n = a143344_list !! (n-1)
    a143344_list = zipWith (-) (tail a022941_list) a022941_list
    -- 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(c[n],n=1..70); # Nathaniel Johnston, May 01 2011

Extensions

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