OFFSET
1,4
COMMENTS
For n > 13: row(n) = row(13), see example.
LINKS
Eric Weisstein's World of Mathematics, Look and Say Sequence
Wikipedia, Look-and-say sequence
EXAMPLE
. 1: [1] -> 1x1 -> [1 | 1] -> row(2)
. 2: [1,1] -> 2x1 -> [2 | 1] -> row(3)
. 3: [2,1] -> 1x1, 1x2 -> [1,1 | 1,2] -> row(4)
. 4: [1,1,1,2] -> 3x1, 1x2 -> [3,1 | 1,2] -> row(5)
. 5: [3,1,1,2] -> 2x1, 1x2, 1x3 -> [2,1,1 | 1,2,3] -> row(6)
. 6: [2,1,1,1,2,3] -> 3x1, 2x2, 1x3 -> [3,2,1 | 1,2,3] -> row(7)
. 7: [3,2,1,1,2,3] -> 2x1, 2x2, 2x3 -> [2,2,2 | 1,2,3] -> row(8)
. 8: [2,2,2,1,2,3] -> 1x1, 4x2, 1x3 -> [1,4,1 | 1,2,3] -> row(9)
. 9: [1,4,1,1,2,3] -> 3x1, 1x2, 1x3, 1x4 -> [3,1,1,1 | 1,2,3] -> row(10)
. 10: [3,1,1,1,1,2,3,4] -> 4x1, 1x2, 2x3, 1x4 -> [4,1,2,1 | 1,2,3,4]
. 11: [4,1,2,1,1,2,3,4] -> 3x1, 2x2, 1x3, 2x4 -> [3,2,1,2 | 1,2,3,4]
. 12: [3,2,1,2,1,2,3,4] -> 2x1, 3x2, 2x3, 1x4 -> [2,3,2,1 | 1,2,3,4]
. 13: [2,3,2,1,1,2,3,4] -> 2x1, 3x2, 2x3, 1x4 -> [2,3,2,1 | 1,2,3,4]
. 14: [2,3,2,1,1,2,3,4] = row(13).
PROG
(Haskell)
import Data.List (sort, group)
a240595 n k = a240595_tabf !! (n-1) !! (k-1)
a240595_row n = a240595_tabf !! (n-1)
a240595_tabf = iterate f [1] where
f xs = concat [map length zss, map head zss]
where zss = group $ sort xs
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Reinhard Zumkeller, Apr 08 2014
STATUS
approved