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.

A138036 Write n = C(i,2)+C(j,1) with i>j>=0; let L[n] = [i,j]; sequence gives list of pairs L[n], n >= 0.

Original entry on oeis.org

1, 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2, 4, 0, 4, 1, 4, 2, 4, 3, 5, 0, 5, 1, 5, 2, 5, 3, 5, 4, 6, 0, 6, 1, 6, 2, 6, 3, 6, 4, 6, 5, 7, 0, 7, 1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6, 8, 0, 8, 1, 8, 2, 8, 3, 8, 4, 8, 5, 8, 6, 8, 7, 9, 0, 9, 1, 9, 2, 9, 3, 9, 4, 9, 5, 9, 6, 9, 7, 9, 8, 10, 0, 10, 1, 10, 2, 10, 3, 10, 4, 10, 5, 10, 6, 10, 7, 10, 8, 10, 9, 11, 0, 11, 1, 11, 2, 11, 3, 11, 4
Offset: 0

Views

Author

N. J. A. Sloane, Sep 04 2011

Keywords

Comments

Each n >= 0 has a unique representation as n = C(i,2)+C(j,1) with i>j>=0. This is the combinatorial number system of degree t = 2. The i values are A002024, the j values A002262.

Examples

			The pairs L[0] through L[10] are
[1, 0]
[2, 0]
[2, 1]
[3, 0]
[3, 1]
[3, 2]
[4, 0]
[4, 1]
[4, 2]
[4, 3]
[5, 0]
		

References

  • D. E. Knuth, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, Section 7.2.1.3, Eq. (20), p. 360.

Crossrefs

Cf. A002024, A002262. See A194847 for degree t=3.

Programs

  • Mathematica
    A138036list[len_] := Module[{i = 0, j = 1, L = {1, 0}}, Do[i++; If[i == j, j++; i = 0]; AppendTo[L, j]; AppendTo[L, i], {len}]; L];
    A138036list[60] (* Jean-François Alcover, Jul 11 2019, after Peter Luschny *)
  • Sage
    def A138036_list(len):
        i, j = 0, 1
        L = [1, 0]
        for _ in range(len):
            i += 1
            if i == j:
                j += 1
                i = 0
            L.append(j)
            L.append(i)
        return L
    A138036_list(47) # Peter Luschny, May 18 2015