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

%I #16 Sep 01 2021 13:37:10

%S 8,81,1181,118112,21128112,211281211221,112212211181211221,

%T 1122122111811322112212,21112212223112811322112212,

%U 21112212223112812112312311221321

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

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

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

%e The term after 1181 is obtained by saying "1 once, 8 once, 1 twice", which gives 118112.

%o (Haskell)

%o import Data.List (group, transpose)

%o a022519 n = a022519_list !! n

%o a022519_list = 8 : f [8] :: [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

%o (Python)

%o from itertools import groupby

%o A022519_list = [8]

%o for _ in range(10):

%o A022519_list.append(int(''.join(str(k)+str(len(list(g))) for k, g in groupby(str(A022519_list[-1])[::-1])))) # _Chai Wah Wu_, Sep 01 2021

%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