(Haskell)
import Data.List (group, transpose)
a022488 n = a022488_list !! (n-1)
a022488_list = 2 : f [2] :: [Integer] where
f xs = (read $ concatMap show ys) : f ys where
ys = concat $ transpose [map head zss, map length zss]
zss = reverse $ group xs
(Python)
from re import split
for _ in range(10):
l = ''.join(d[0]+str(len(d)) for d in split('(0+|1+|2+|3+|4+|5+|6+|7+|8+|9+)', l[::-1]) if d != '')
(Python)
from itertools import accumulate, groupby, repeat
def summarize(n, _):
return int("".join(k+str(len(list(g))) for k, g in groupby(str(n)[::-1])))
def aupton(nn): return list(accumulate(repeat(2, nn), summarize))