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

A057557 Lexicographic ordering of NxNxN, where N={1,2,3,...}.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 3, 1, 2, 2, 1, 3, 1, 2, 1, 2, 2, 2, 1, 3, 1, 1, 1, 1, 4, 1, 2, 3, 1, 3, 2, 1, 4, 1, 2, 1, 3, 2, 2, 2, 2, 3, 1, 3, 1, 2, 3, 2, 1, 4, 1, 1, 1, 1, 5, 1, 2, 4, 1, 3, 3, 1, 4, 2, 1, 5, 1, 2, 1, 4, 2, 2, 3, 2, 3, 2, 2, 4, 1, 3, 1, 3, 3, 2, 2, 3, 3, 1, 4, 1, 2, 4, 2, 1, 5, 1, 1, 1, 1, 6, 1, 2, 5, 1, 3, 4, 1, 4, 3, 1, 5, 2, 1, 6, 1, 2, 1, 5, 2, 2, 4, 2, 3, 3, 2, 4, 2, 2, 5, 1, 3, 1, 4, 3, 2, 3, 3, 3, 2, 3, 4, 1, 4, 1, 3, 4, 2, 2, 4, 3, 1, 5, 1, 2, 5, 2, 1, 6, 1, 1
Offset: 1

Views

Author

Clark Kimberling, Sep 07 2000

Keywords

Examples

			Flatten the list of ordered lattice points, (1,1,1) < (1,1,2) < (1,2,1) < ..., to 1,1,1, 1,1,2, 1,2,1, ...
		

Crossrefs

A057555: ordering of N^2
A057559: ordering of N^4
A186006: ordering of N^5
A186003: distances to the plane x=0
A186004: distances to the plane y=0
A186005: distances to the plane z=0

Programs

  • Mathematica
    lexicographicLattice[{dim_,maxHeight_}]:= Flatten[Array[Sort@Flatten[(Permutations[#1]&)/@IntegerPartitions[#1+dim-1,{dim}],1]&,maxHeight],1]; Flatten@lexicographicLattice[{3,6}]
    (* By Peter J. C. Moses, Feb 10 2011 *)

Extensions

Corrected and extended by Clark Kimberling,, Feb 10 2011.

A057555 Lexicographic ordering of N x N, where N = {1,2,3...}.

Original entry on oeis.org

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

Views

Author

Clark Kimberling, Sep 07 2000

Keywords

Examples

			Flatten the ordered lattice points (1,1) < (1,2) < (2,1) < (1,3) < (2,2) < ... as 1,1, 1,2, 2,1, 1,3, 2,2, ...
		

Crossrefs

Programs

  • Mathematica
    lexicographicLattice[{dim_,maxHeight_}]:= Flatten[Array[Sort@Flatten[(Permutations[#1]&)/@IntegerPartitions[#1+dim-1,{dim}],1]&,maxHeight],1]; Flatten@lexicographicLattice[{2,12}] (* Peter J. C. Moses, Feb 10 2011 *)
    u[x_] := Floor[3/2 + Sqrt[2*x]]; v[x_] := Floor[1/2 + Sqrt[2*x]]; n[x_] := x - v[x]*(v[x] - 1)/2; k[x_] := 1 - x + u[x]*(u[x] - 1)/2; Flatten[Table[{n[m], k[m]}, {m, 45}]] (* L. Edson Jeffery, Jun 20 2015 *)
  • PARI
    a(n)= if(n<1, 0, 1+(-1)^(n%2) * (binomial((n+1)%2+(sqrtint(4*n)+1)\2, 2)-n\2)) /* Michael Somos, Mar 06 2004 */

Formula

a(2n) = A004736(n), a(2n+1) = A002260(n). - Michael Somos, Mar 06 2004
Let p(i,j) be the position of (i,j) in the ordering. Then p(i,j) = ((i+j)^2-i-3j+2)/2. Inversely, the pair (i,j) in a given position p is given by i=p-q(q-1)/2 and j=q+1-i, where q=floor((1+sqrt(8k-7))/2).

Extensions

Extended by Clark Kimberling, Feb 10 2011

A057554 Lexicographic ordering of MxM, where M={0,1,2,...}.

Original entry on oeis.org

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

Views

Author

Clark Kimberling, Sep 07 2000

Keywords

Comments

A057555 gives the lexicographic ordering of N x N, where N={1,2,3,...}.

Examples

			Flatten the ordered lattice points: (0,0) < (0,1) < (1,0) < (0,2) < (1,1) < ... as 0,0, 0,1, 1,0, 0,2, 1,1, ...
		

Crossrefs

Programs

  • Mathematica
    lexicographicLattice[{dim_,maxHeight_}]:= Flatten[Array[Sort@Flatten[(Permutations[#1]&)/@IntegerPartitions[#1+dim-1,{dim}],1]&,maxHeight],1]; Flatten@lexicographicLattice[{2,12}]-1 (* Peter J. C. Moses, Feb 10 2011 *)
  • Python
    [l for i in range(20) for k in range(i,-1,-1) for l in (i-k, k)] # Nicholas Stefan Georgescu, Oct 10 2023

A057558 Lexicographic ordering of MxMxMxM, where M={0,1,2,...}.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 1, 0, 0, 2, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 1, 2, 0, 0, 2, 1, 0, 0, 3, 0, 0, 1, 0, 2, 0, 1, 1, 1, 0, 1, 2, 0, 0, 2, 0, 1, 0, 2, 1, 0, 0, 3, 0, 0, 1, 0, 0, 2, 1, 0, 1, 1, 1, 0, 2, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 2, 0, 0, 2, 0, 0, 1, 2, 0, 1, 0, 2, 1, 0, 0, 3, 0, 0, 0
Offset: 1

Views

Author

Clark Kimberling, Sep 07 2000

Keywords

Examples

			Flatten the list of ordered lattice points, (0,0,0,0) < (0,0,0,1) < (0,0,1,0) < ... as 0,0,0,0, 0,0,0,1, 0,0,1,0, ...
		

Crossrefs

Programs

  • Mathematica
    lexicographicLattice[{dim_,maxHeight_}]:= Flatten[Array[Sort@Flatten[(Permutations[#1]&)/@IntegerPartitions[#1+dim-1,{dim}],1]&,maxHeight],1]; Flatten@lexicographicLattice[{4,4}]-1
    (* by Peter J. C. Moses, Feb 10 2011 *)

Extensions

Extended by Clark Kimberling, Feb 10 2011

A186006 Lexicographic ordering of N x N x N x N x N, where N={1,2,3,...}.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 2, 2, 1, 1, 1, 3, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 3, 1, 1, 1, 3, 2, 1, 1, 1, 4, 1, 1, 1, 2, 1, 3, 1, 1, 2, 2, 2, 1, 1, 2, 3, 1, 1, 1, 3, 1, 2, 1, 1, 3, 2, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 3
Offset: 1

Views

Author

Clark Kimberling, Feb 10 2011

Keywords

Comments

By changing a single number, the Mathematica code suffices for other dimensions: N x N (A057555), N x N x N (A057557), N x N x N x N (A057559), and higher.

Examples

			First, list the 5-tuples in lexicographic order: (1,1,1,1,1) < (1,1,1,1,2) < (1,1,1,2,1) < (1,1,2,1,1) < ... < (1,2,2,1,1) < (1,1,3,1,1) < ... Then flatten the list, leaving 1,1,1,1,1, 1,1,1,1,2, 1,1,1,2,1, 1,1,2,1,1, ...
		

Crossrefs

Programs

  • Mathematica
    lexicographicLattice[{dim_,maxHeight_}]:= Flatten[Array[Sort@Flatten[(Permutations[#1]&)/@IntegerPartitions[#1+dim-1,{dim}],1]&,maxHeight],1];
    lexicographicLatticeHeightArray[{dim_,maxHeight_,axis_}]:= Array[Flatten@Position[Map[#[[axis]]&, lexicographicLattice[{dim,maxHeight}]],#]&,maxHeight]
    Take[Flatten@lexicographicLattice[{5,12}],160]
    (* Peter J. C. Moses, Feb 10 2011 *)
Showing 1-5 of 5 results.