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.

A248141 Table read by rows: n-th row contains all subsets of consecutive numbers of 1..n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Oct 02 2014

Keywords

Comments

A000292(n) = length of n-th row, whereas A000217(n) = number of all consecutive subsets of numbers 1..n;
A248147(n,k) = A000040(T(n,k)), 1 <= k <= A000292(n).

Examples

			.  1: 1
.  2: 1,2,1,2
.  3: 1,2,3,1,2,2,3,1,2,3
.  4: 1,2,3,4,1,2,2,3,3,4,1,2,3,2,3,4,1,2,3,4
.  5: 1,2,3,4,5,1,2,2,3,3,4,4,5,1,2,3,2,3,4,3,4,5,1,2,3,4,2,3,4,5,1,2,3,4,5
rows concatenated from:
.  1: [1]
.  2: [1] [2] [1,2]
.  3: [1] [2] [3] [1,2] [2,3] [1,2,3]
.  4: [1] [2] [3] [4] [1,2] [2,3] [3,4] [1,2,3] [2,3,4] [1,2,3,4]
.  5: [1] [2] [3] [4] [5] [1,2] [2,3] [3,4] [4,5] [1,2,3] [2,3,4] ...
		

Crossrefs

Cf. A000292 (row lengths), A000217, A248147.

Programs

  • Haskell
    import Data.List (group)
    a248141 n k = a248141_tabf !! (n-1) !! (k-1)
    a248141_row n = a248141_tabf !! (n-1)
    a248141_tabf = map concat usss where
       usss = iterate f [[1]] where
         f vss = group [1 .. last (last vss) + 1] ++
                 map (\ws -> ws ++ [last ws + 1]) vss
  • Mathematica
    Flatten[Table[Flatten[Table[Partition[Range[n],i,1],{i,n}]],{n,6}]] (* Harvey P. Dale, Feb 03 2015 *)