Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A022510
Describe previous term from the right (method A - initial term is 6).
0
6, 16, 1611, 211611, 21162112, 122112162112, 122112161112212211, 2122112231161112212211, 21221122311621132221221112, 12312211321321121621132221221112
OFFSET
0,1
COMMENTS
Method A = 'frequency' followed by 'digit'-indication.
EXAMPLE
E.g., the term after 1611 is obtained by saying "two 1's, one 6, one 1", which gives 211611.
MATHEMATICA
a[1]=6; a[n_]:= a[n]= IntegerReverse[ FromDigits[ Flatten[ Replace[ Replace[ Replace[ Split[ IntegerDigits[a[n-1]]], {x_, y_}->{x, Length[{x, y}]}, {1}], {x_, y_, z_}->{x, Length[{x, y, z}]}, {1}], {x_}->{x, Length[{x}]}, {1}]]]];
Array[a, 10] (* Ivan N. Ianakiev, Jul 23 2019 *)
PROG
(Python)
from re import split
A022510_list, l = [6], '6'
for _ in range(10):
l = ''.join(str(len(d))+d[0] for d in split('(0+|1+|2+|3+|4+|5+|6+|7+|8+|9+)', l[::-1]) if d)
A022510_list.append(int(l)) # Chai Wah Wu, Jan 02 2015
KEYWORD
nonn,base,easy,nice
EXTENSIONS
More terms from Erich Friedman
STATUS
approved