This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A022470 #24 Feb 21 2021 06:27:35 %S A022470 2,21,2111,2113,211231,2112213111,211222113113,21122312311231, %T A022470 2112223111213112213111,21122331132111311222113113, %U A022470 211222321231211331122312311231,21122331211121311121123212223111213112213111,21122232112113211131132112213121112331132111311222113113 %N A022470 Describe the previous term! (method B - initial term is 2). %C A022470 Method B = 'digit'-indication followed by 'frequency'. %H A022470 Peter J. C. Moses, <a href="/A022470/b022470.txt">Table of n, a(n) for n = 1..23</a> %e A022470 E.g., the term after 2113 is obtained by saying "2 once, 1 twice, 3 once", which gives 211231. %t A022470 a[1] = 2; a[n_] := a[n] = FromDigits[Flatten[{First[#], Length[#]} & /@ Split[IntegerDigits[a[n - 1]]]]]; Map[a,Range[1, 23]] (* _Peter J. C. Moses_, Mar 22 2013 *) %o A022470 (Python) %o A022470 from itertools import accumulate, groupby, repeat %o A022470 def summarize(n, _): %o A022470 return int("".join(k+str(len(list(g))) for k, g in groupby(str(n)))) %o A022470 def aupton(nn): return list(accumulate(repeat(2, nn), summarize)) %o A022470 print(aupton(13)) # _Michael S. Branicky_, Feb 21 2021 %Y A022470 Cf. A007651, A022499, A022500-A022505. %Y A022470 Cf. A006751 (method A). %K A022470 nonn,base,easy,nice %O A022470 1,1 %A A022470 _Clark Kimberling_