%I #6 Apr 11 2016 08:46:24
%S 1,1,1,2,1,1,1,1,2,3,1,1,2,2,1,1,1,2,3,3,2,1,1,2,3,2,2,2,1,2,3,1,4,1,
%T 1,2,3,3,1,1,1,1,2,3,4,4,1,2,1,1,2,3,4,3,2,1,2,1,2,3,4,2,3,2,1,1,2,3,
%U 4,2,3,2,1,1,2,3,4,2,3,2,1,1,2,3,4,2
%N Look-and-Say table, where in row(n+1) the sorted list of distinct terms of row(n) is preceded by the list of numbers of their occurrences.
%C For n > 13: row(n) = row(13), see example.
%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 . 1: [1] -> 1x1 -> [1 | 1] -> row(2)
%e . 2: [1,1] -> 2x1 -> [2 | 1] -> row(3)
%e . 3: [2,1] -> 1x1, 1x2 -> [1,1 | 1,2] -> row(4)
%e . 4: [1,1,1,2] -> 3x1, 1x2 -> [3,1 | 1,2] -> row(5)
%e . 5: [3,1,1,2] -> 2x1, 1x2, 1x3 -> [2,1,1 | 1,2,3] -> row(6)
%e . 6: [2,1,1,1,2,3] -> 3x1, 2x2, 1x3 -> [3,2,1 | 1,2,3] -> row(7)
%e . 7: [3,2,1,1,2,3] -> 2x1, 2x2, 2x3 -> [2,2,2 | 1,2,3] -> row(8)
%e . 8: [2,2,2,1,2,3] -> 1x1, 4x2, 1x3 -> [1,4,1 | 1,2,3] -> row(9)
%e . 9: [1,4,1,1,2,3] -> 3x1, 1x2, 1x3, 1x4 -> [3,1,1,1 | 1,2,3] -> row(10)
%e . 10: [3,1,1,1,1,2,3,4] -> 4x1, 1x2, 2x3, 1x4 -> [4,1,2,1 | 1,2,3,4]
%e . 11: [4,1,2,1,1,2,3,4] -> 3x1, 2x2, 1x3, 2x4 -> [3,2,1,2 | 1,2,3,4]
%e . 12: [3,2,1,2,1,2,3,4] -> 2x1, 3x2, 2x3, 1x4 -> [2,3,2,1 | 1,2,3,4]
%e . 13: [2,3,2,1,1,2,3,4] -> 2x1, 3x2, 2x3, 1x4 -> [2,3,2,1 | 1,2,3,4]
%e . 14: [2,3,2,1,1,2,3,4] = row(13).
%o (Haskell)
%o import Data.List (sort, group)
%o a240595 n k = a240595_tabf !! (n-1) !! (k-1)
%o a240595_row n = a240595_tabf !! (n-1)
%o a240595_tabf = iterate f [1] where
%o f xs = concat [map length zss, map head zss]
%o where zss = group $ sort xs
%Y Cf. A034002.
%K nonn,tabf
%O 1,4
%A _Reinhard Zumkeller_, Apr 08 2014
|