cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A079475 Number described by n using the "Look and Say" rule.

This page as a plain text file.
%I A079475 #11 Sep 01 2021 16:08:17
%S A079475 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,11,22,33,44,55,66,77,88,99,
%T A079475 0,111,222,333,444,555,666,777,888,999,0,1111,2222,3333,4444,5555,
%U A079475 6666,7777,8888,9999,0
%N A079475 Number described by n using the "Look and Say" rule.
%C A079475 n is read one digit at a time, leftover single digits describe themselves and trailing zeros are ignored.
%C A079475 In many, but not all cases, a(n) acts as an inverse to the "Look and Say" sequence A005150. For example, 4113 -> 142113 under the "Look and Say" and 142113 -> 4113 under a(n).
%e A079475 142113 can be read as one "4", two "1"s, one "3" and so describes 4113. Hence a(142113) = 4113. 123 can be read as one "2", "3" and so describes 23. (The leftover digit 3 describes itself.) Hence a(123) = 23. Note that a(1213) = 23 also. 40 can be read as four "0"s, so a(40) = 0. (Trailing zeros are ignored.) 4. a(5) = 5. A single digit describes itself.
%t A079475 a[n_] := Table[#[[2]], {#[[1]]}]& /@ Partition[If[EvenQ[Length[id = IntegerDigits[n]]], id, Join[Most[id], {1}, {id[[-1]]}]], 2] // Flatten // FromDigits; Table[a[n], {n, 0, 123}] (* _Jean-François Alcover_, Mar 02 2017 *)
%o A079475 (Python)
%o A079475 def A079475(n):
%o A079475     s = str(n)
%o A079475     l = len(s)
%o A079475     if l % 2:
%o A079475         s = s[:-1]+'1'+s[-1]
%o A079475     return int(''.join(s[i+1]*int(s[i]) for i in range(0,l,2))) # _Chai Wah Wu_, Sep 01 2021
%Y A079475 Cf. A005150.
%K A079475 base,nonn,nice
%O A079475 0,3
%A A079475 _Joseph L. Pe_, Jan 15 2003