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.

A034002 A005150 expanded into single digits.

Original entry on oeis.org

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

Views

Author

Keywords

Examples

			Initial rows                             A005150
  1:  1                                           1
  2:  1,1                                        11
  3:  2,1                                        21
  4:  1,2,1,1                                  1211
  5:  1,1,1,2,2,1                            111221
  6:  3,1,2,2,1,1                            312211
  7:  1,3,1,1,2,2,2,1                      13112221
  8:  1,1,1,3,2,1,3,2,1,1                1113213211
  9:  3,1,1,3,1,2,1,1,1,3,1,2,2,1    31131211131221
		

Crossrefs

See the entry for A005150 for much more about this sequence.
Cf. A088203.
Cf. A005341 (row lengths), A220424 (method B version).

Programs

  • Haskell
    -- see Watkins link, p. 3.
    import Data.List (group)
    a034002 n k = a034002_tabf !! (n-1) !! (k-1)
    a034002_row n = a034002_tabf !! (n-1)
    a034002_tabf = iterate
                   (concat . map (\xs -> [length xs, head xs]) . group) [1]
    -- Reinhard Zumkeller, Aug 09 2012
    
  • Python
    from sympy import flatten
    l=[1]
    L=[1]
    n=s=1
    y=''
    while n<21:
        x=str(l[n - 1]) + ' '
        for i in range(len(x) - 1):
            if x[i]==x[i + 1]: s+=1
            else:
                y+=str(s)+str(x[i])
                s=1
        x=''
        n+=1
        l.append(int(y))
        L.append([int(a) for a in list(y)])
        y=''
        s=1
    print(l) # A005150
    print(flatten(L)) # Indranil Ghosh, Jul 05 2017

Formula

A005150(n) = Sum_{k=1..A005341(n)} T(n,k)*10^(A005341(n) - k). - Reinhard Zumkeller, Dec 15 2012

Extensions

Offset changed and keyword tabf added by Reinhard Zumkeller, Aug 09 2012