login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Describe previous term from the right (method B - initial term is 3).
9

%I #15 Oct 06 2019 16:55:25

%S 3,31,1131,113112,21123112,211231211221,112212211131211221,

%T 1122122111311322112212,21112212223112311322112212,

%U 21112212223112312112312311221321

%N Describe previous term from the right (method B - initial term is 3).

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

%H Reinhard Zumkeller, <a href="/A022514/b022514.txt">Table of n, a(n) for n = 0..21</a>

%e The term after 1131 is obtained by saying "1 once, 3 once, 1 twice", which gives 113112.

%t A022514[1]:=3;A022514[n_]:=A022514[n]=FromDigits[Flatten[{First[#],Length[#]}&/@Split[Reverse[IntegerDigits[A022514[n-1]]]]]];Map[A022514,Range[15]] (* _Peter J. C. Moses_, Apr 22 2013 *)

%o (Haskell)

%o import Data.List (group, transpose)

%o a022514 n = a022514_list !! n

%o a022514_list = 3 : f [3] :: [Integer] where

%o f xs = (read $ concatMap show ys) : f ys where

%o ys = concat $ transpose [map head zss, map length zss]

%o zss = reverse $ group xs

%o -- _Reinhard Zumkeller_, Jan 26 2014

%Y Cf. A022481, A022488, A022515-A022520.

%K nonn,base,easy,nice

%O 0,1

%A _N. J. A. Sloane_

%E More terms from _Patrick De Geest_, Jun 15 1999