Help:=proc(): print(`JC(w), YN(INI,n), JC1(w) `): end: #The Conway Look-And-Say sequence #JC(w): inputs any list in and outputs its #Yusra transform #a1^c1,a2^c2,..., ar^cr ->[a1,c1,a2,c2,a3,c3, ...] JC:=proc(w) local i,a1,c1,w1,J1: option remember: if w=[] then RETURN([]): fi: a1:=w[1]: for i from 1 to nops(w) while w[i]=a1 do od: c1:=i-1: w1:=w[c1+1..nops(w)]: J1:=JC(w1): [c1,a1,op(J1)]: end: #YN(INI,n): the first n terms of the #sequence : "length of JC^n(INI) YN:=proc(INI,n) local s,i,Cu: s:=[]: Cu:=INI: for i from 1 to n do s:=[op(s), nops(Cu)]: Cu:=JC(Cu): od: s: end: #JC1(w): inputs any list in and outputs its #Yusra transform, not using recursion #a1^c1,a2^c2,..., ar^cr ->[a1,c1,a2,c2,a3,c3, ...] JC1:=proc(w) local i,a1,c1,w1,J1,L: option remember: if w=[] then RETURN([]): fi: L:=[]: w1:=w: while w1<>[] do a1:=w1[1]: for i from 1 to nops(w1) while w1[i]=a1 do od: c1:=i-1: L:=[op(L),c1,a1]: w1:=w1[c1+1..nops(w1)]: od: L: end: #YN1(INI,n): the first n terms of the #sequence : "length of JC^n(INI) YN1:=proc(INI,n) local s,i,Cu: s:=[]: Cu:=INI: for i from 1 to n do s:=[op(s), nops(Cu)]: Cu:=JC1(Cu): od: s: end: