login
Describe previous term from the right (method B - initial term is 5).
4

%I #12 Oct 06 2019 16:55:06

%S 5,51,1151,115112,21125112,211251211221,112212211151211221,

%T 1122122111511322112212,21112212223112511322112212,

%U 21112212223112512112312311221321

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

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

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

%e The term after 1151 is obtained by saying "1 once, 5 once, 1 twice", which gives 115112.

%o (Haskell)

%o import Data.List (group, transpose)

%o a022516 n = a022516_list !! n

%o a022516_list = 5 : f [5] :: [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, A022514-A022520.

%K nonn,base,easy,nice

%O 0,1

%A _N. J. A. Sloane_

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