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.

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).