login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A022470 Describe the previous term! (method B - initial term is 2). 15

%I #24 Feb 21 2021 06:27:35

%S 2,21,2111,2113,211231,2112213111,211222113113,21122312311231,

%T 2112223111213112213111,21122331132111311222113113,

%U 211222321231211331122312311231,21122331211121311121123212223111213112213111,21122232112113211131132112213121112331132111311222113113

%N Describe the previous term! (method B - initial term is 2).

%C Method B = 'digit'-indication followed by 'frequency'.

%H Peter J. C. Moses, <a href="/A022470/b022470.txt">Table of n, a(n) for n = 1..23</a>

%e E.g., the term after 2113 is obtained by saying "2 once, 1 twice, 3 once", which gives 211231.

%t 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 (Python)

%o from itertools import accumulate, groupby, repeat

%o def summarize(n, _):

%o return int("".join(k+str(len(list(g))) for k, g in groupby(str(n))))

%o def aupton(nn): return list(accumulate(repeat(2, nn), summarize))

%o print(aupton(13)) # _Michael S. Branicky_, Feb 21 2021

%Y Cf. A007651, A022499, A022500-A022505.

%Y Cf. A006751 (method A).

%K nonn,base,easy,nice

%O 1,1

%A _Clark Kimberling_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 03:28 EDT 2024. Contains 371696 sequences. (Running on oeis4.)