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.

A218978 Table read by rows: n-th row lists all distinct substrings of decimal representation of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 10, 1, 11, 1, 2, 12, 1, 3, 13, 1, 4, 14, 1, 5, 15, 1, 6, 16, 1, 7, 17, 1, 8, 18, 1, 9, 19, 0, 2, 20, 1, 2, 21, 2, 22, 2, 3, 23, 2, 4, 24, 2, 5, 25, 2, 6, 26, 2, 7, 27, 2, 8, 28, 2, 9, 29, 0, 3, 30, 1, 3, 31, 2, 3, 32, 3
Offset: 0

Views

Author

Reinhard Zumkeller, May 02 2015, Nov 10 2012

Keywords

Comments

A120004(n) = length of n-th row;
A154771(n) = sum of n-th row.

Examples

			Rows 100 .. 112:
.  100:  {0, 1, 10, 100},
.  101:  {0, 1, 10, 101},
.  102:  {0, 1, 2, 10, 102},
.  103:  {0, 1, 3, 10, 103},
.  104:  {0, 1, 4, 10, 104},
.  105:  {0, 1, 5, 10, 105},
.  106:  {0, 1, 6, 10, 106},
.  107:  {0, 1, 7, 10, 107},
.  108:  {0, 1, 8, 10, 108},
.  109:  {0, 1, 9, 10, 109},
.  110:  {0, 1, 10 ,11, 110},
.  111:  {1, 11, 111},
.  112:  {1, 2, 11, 12, 112}.
		

Crossrefs

Cf. A031298, A219031 (squares in row), A262188 (palindromes in row).

Programs

  • Haskell
    import Data.List (inits, tails, sort, nub, genericIndex)
    a218978 n k = a218978_row n !! k
    a218978_row n = genericIndex a218978_tabf n
    a218978_tabf = map (sort . nub . map (foldr (\d v -> 10 * v + d) 0) .
                       concatMap (tail . inits) . tails) a031298_tabf
    -- Reinhard Zumkeller, corrected: Sep 15 2015, May 02 2015, Nov 10 2012