cp's OEIS Frontend

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.

A022512 Describe previous term from the right (method A - initial term is 8).

This page as a plain text file.
%I A022512 #12 Nov 27 2016 22:01:56
%S A022512 8,18,1811,211811,21182112,122112182112,122112181112212211,
%T A022512 2122112231181112212211,21221122311821132221221112,
%U A022512 12312211321321121821132221221112
%N A022512 Describe previous term from the right (method A - initial term is 8).
%C A022512 Method A = 'frequency' followed by 'digit'-indication.
%e A022512 E.g., the term after 1811 is obtained by saying "two 1's, one 8, one 1", which gives 211811.
%t A022512 split[n_]:=Split[Reverse[IntegerDigits[n]]];
%t A022512 list1[n_]:=List/@Length/@split[n];riffle1[n_]:=Riffle[split[n],list1[n]];
%t A022512 tab[n_]:=Table[i,{i,1,2*Length[list1[n]],2}];
%t A022512 list2[n_]:=Append[riffle1[n][[#]],riffle1[n][[#+1]]]&/@tab[n];
%t A022512 flat[n_]:=Flatten/@list2[n];riffle2[n_]:=Riffle[Last/@flat[n],First/@flat[n]];
%t A022512 a[1]=8; a[n_]:=FromDigits[riffle2[a[n-1]]]; Array[a,10] (* or *)
%t A022512 IntegerReverse[NestList[FromDigits[Flatten[Replace[Replace[Replace[Split[Reverse[IntegerDigits[#]]],{x_,y_}->{x,Length[{x,y}]},{1}],{x_,y_,z_}->{x,Length[{x,y,z}]},{1}],{x_}->{x,Length[{x}]},{1}]]]&,8,9]] (* _Ivan N. Ianakiev_, Nov 10 2016 *)
%Y A022512 Cf. A022506, A006711, A022482, A022507-A022513.
%K A022512 nonn,base,easy,nice
%O A022512 0,1
%A A022512 _N. J. A. Sloane_
%E A022512 More terms from _Erich Friedman_