fork download
  1. encode :: [Int] -> [Int]
  2. encode [] = []
  3. encode nn@(n:_) = l:n:encode post
  4. where (pre,post) = span (==n) nn
  5. l = length pre
  6.  
  7. main = mapM_ (putStrLn . concatMap show) . take 20 . iterate encode $ [3]
Success #stdin #stdout 0s 4584KB
stdin
Standard input is empty
stdout
3
13
1113
3113
132113
1113122113
311311222113
13211321322113
1113122113121113222113
31131122211311123113322113
132113213221133112132123222113
11131221131211132221232112111312111213322113
31131122211311123113321112131221123113111231121123222113
1321132132211331121321231231121113112221121321133112132112211213322113
11131221131211132221232112111312111213111213211231132132211211131221232112111312212221121123222113
3113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112211322112211213322113
132113213221133112132123123112111311222112132113311213211231232112311311222112111312211311123113322112132113212231121113112221121321132122211322212221121123222113
111312211312111322212321121113121112131112132112311321322112111312212321121113122112131112131221121321132132211231131122211331121321232221121113122113121122132112311321322112111312211312113221133211322112211213322113
3113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112212211131221121321131211132221123113112221131112211322212312211322212221121123222113
1321132132211331121321231231121113112221121321133112132112312321123113112221121113122113111231133221121321132122311211131122211213211321322112312321123113213221123113112221131112311332211211131221131211132211121312211231131112311211232221121321132132211331221122311311222112111312211311123113322112132113213221133122211332111213112221133211322112211213322113