login
A005150 expanded into single digits.
7

%I #29 Apr 08 2021 03:41:42

%S 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,

%T 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,

%U 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

%N A005150 expanded into single digits.

%C A005150(n) = Sum_{k=1..A005341(n)} T(n,k)*10^(A005341(n) - k). - _Reinhard Zumkeller_, Dec 15 2012

%H Reinhard Zumkeller, <a href="/A034002/b034002.txt">Rows n = 1..25 of triangle, flattened</a>

%H J. H. Conway, <a href="http://www.math.utah.edu/~boocher/writings/ConwayLook.pdf">The weird and wonderful chemistry of audioactive decay</a>, in T. M. Cover and Gopinath, eds., Open Problems in Communication and Computation, Springer, NY 1987, pp. 173-188. DOI: 10.1007/978-1-4612-4808-8_53.

%H M. Lothaire, <a href="http://www-igm.univ-mlv.fr/~berstel/Lothaire/">Algebraic Combinatorics on Words</a>, Cambridge, 2002, see p. 36.

%H Kevin Watkins, <a href="http://www.cs.cmu.edu/~kw/pubs/conway.pdf">Abstract Interpretation Using Laziness: Proving Conway's Lost Cosmological Theorem</a>

%H Kevin Watkins, <a href="http://www.cs.cmu.edu/~kw/pubs/conwayslides.pdf">Proving Conway's Lost Cosmological Theorem</a>, POP seminar talk, CMU, Dec 2006.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/LookandSaySequence.html">Look and Say Sequence</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Look-and-say_sequence">Look-and-say sequence</a>

%e . Initial rows A005150

%e . 1: 1 1

%e . 2: 1,1 11

%e . 3: 2,1 21

%e . 4: 1,2,1,1 1211

%e . 5: 1,1,1,2,2,1 111221

%e . 6: 3,1,2,2,1,1 312211

%e . 7: 1,3,1,1,2,2,2,1 13112221

%e . 8: 1,1,1,3,2,1,3,2,1,1 1113213211

%e . 9: 3,1,1,3,1,2,1,1,1,3,1,2,2,1 31131211131221

%e -}

%o (Haskell) see Watkins link, p. 3.

%o import Data.List (group)

%o a034002 n k = a034002_tabf !! (n-1) !! (k-1)

%o a034002_row n = a034002_tabf !! (n-1)

%o a034002_tabf = iterate

%o (concat . map (\xs -> [length xs, head xs]) . group) [1]

%o -- _Reinhard Zumkeller_, Aug 09 2012

%o (Python)

%o from sympy import flatten

%o l=[1]

%o L=[1]

%o n=s=1

%o y=''

%o while n<21:

%o x=str(l[n - 1]) + ' '

%o for i in range(len(x) - 1):

%o if x[i]==x[i + 1]: s+=1

%o else:

%o y+=str(s)+str(x[i])

%o s=1

%o x=''

%o n+=1

%o l.append(int(y))

%o L.append([int(a) for a in list(y)])

%o y=''

%o s=1

%o print(l) # A005150

%o print(flatten(L)) # _Indranil Ghosh_, Jul 05 2017

%Y See the entry for A005150 for much more about this sequence.

%Y Cf. A088203.

%Y Cf. A005341 (row lengths), A220424 (method B version).

%K nonn,base,tabf

%O 1,4

%A _N. J. A. Sloane_

%E Offset changed and keyword tabf added by _Reinhard Zumkeller_, Aug 09 2012