login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A005150 Look and Say sequence: describe the previous term! (method A - initial term is 1).
(Formerly M4780)
139

%I M4780

%S 1,11,21,1211,111221,312211,13112221,1113213211,31131211131221,

%T 13211311123113112211,11131221133112132113212221,

%U 3113112221232112111312211312113211,1321132132111213122112311311222113111221131221,11131221131211131231121113112221121321132132211331222113112211,311311222113111231131112132112311321322112111312211312111322212311322113212221

%N Look and Say sequence: describe the previous term! (method A - initial term is 1).

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

%C Also known as the "Say What You See" sequence.

%C Only the digits 1, 2 and 3 appear in any term. - _Robert G. Wilson v_, Jan 22 2004

%C All terms end with 1 (the seed) and, except the third a(3), begin with 1 or 3. - _Jean-Christophe Hervé_, May 07 2013

%C Proof that 333 never appears in any a(n): suppose it appears for the first time in a(n); because of 'three 3' in 333, it would imply that 333 is also in a(n-1), which is a contradiction. - _Jean-Christophe Hervé_, May 09 2013

%C This sequence created by John Horton Conway in 1986 is called "suite de Conway" in French (see Wikipédia link). - _Bernard Schott_, Jan 10 2021

%D J. H. Conway, The weird and wonderful chemistry of audioactive decay, Eureka 46 (1986) 5-16.

%D S. R. Finch, Mathematical Constants, Cambridge, 2003, section 6.12 Conway's Constant, pp. 452-455.

%D M. Gilpin, On the generalized Gleichniszahlen-Reihe sequence, Manuscript, Jul 05 1994.

%D A. Lakhtakia and C. Pickover, Observations on the Gleichniszahlen-Reihe: An Unusual Number Theory Sequence, J. Recreational Math., 25 (No. 3, 1993), 192-198.

%D Clifford A. Pickover, Computers and the Imagination, St Martin's Press, NY, 1991.

%D Clifford A. Pickover, Fractal horizons: the future use of fractals, New York: St. Martin's Press, 1996. ISBN 0312125992. Chapter 7 has an extensive description of the elements and their properties.

%D C. A. Pickover, The Math Book, Sterling, NY, 2009; see p. 486.

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%D James J. Tattersall, Elementary Number Theory in Nine Chapters, 1999, p. 23.

%D I. Vardi, Computational Recreations in Mathematica. Addison-Wesley, Redwood City, CA, 1991, p. 4.

%H T. D. Noe, <a href="/A005150/b005150.txt">Table of n, a(n) for n = 1..25</a>

%H Henry Bottomley, <a href="http://www.se16.info/js/lands2.htm">Evolution of Conway's 92 Look and Say audioactive elements</a>

%H Éric Brier, Rémi Géraud-Stewart, David Naccache, Alessandro Pacco, and Emanuele Troiani, <a href="https://arxiv.org/abs/2006.06837">Stuttering Conway Sequences Are Still Conway Sequences</a>, arXiv:2006.06837 [math.DS], 2020.

%H Éric Brier, Rémi Géraud-Stewart, David Naccache, Alessandro Pacco, and Emanuele Troiani, <a href="https://arxiv.org/abs/2006.07246">The Look-and-Say The Biggest Sequence Eventually Cycles</a>, arXiv:2006.07246 [math.DS], 2020.

%H Onno M. Cain and Sela T. Enin, <a href="https://arxiv.org/abs/2004.00209">Inventory Loops (i.e. Counting Sequences) have Pre-period 2 max S_1 + 60</a>, arXiv:2004.00209 [math.NT], 2020.

%H Ben Chen, Richard Chen, Joshua Guo, Tanya Khovanova, Shane Lee, Neil Malur, Nastia Polina, Poonam Sahoo, Anuj Sakarda, Nathan Sheffield, and Armaan Tipirneni, <a href="https://arxiv.org/abs/1808.04199">On Base 3/2 and its Sequences</a>, arXiv:1808.04304 [math.NT], 2018.

%H J. H. Conway, <a href="http://dx.doi.org/10.1007/978-1-4612-4808-8_53">The weird and wonderful chemistry of audioactive decay</a>, in T. M. Cover and Gopinath, eds., Open Problems in Communication and Computation, Springer, NY 1987, pp. 173-188.

%H J. H. Conway and Brady Haran, <a href="https://www.youtube.com/watch?v=ea7lJkEhytA">Look-and-Say Numbers</a> (2014), Numberphile video.

%H S. B. Ekhad and D. Zeilberger, <a href="https://arxiv.org/abs/math/9808077">Proof of Conway's Lost Cosmological Theorem</a>, arXiv:math/9808077 [math.CO], 1998.

%H S. B. Ekhad and D. Zeilberger, <a href="http://www.ams.org/era/1997-03-11/S1079-6762-97-00026-7/home.html">Proof of Conway's lost cosmological theorem</a>, Electron. Res. Announc. Amer. Math. Soc. 3 (1997), 78-82.

%H S. Eliahou and M. J. Erickson, <a href="https://doi.org/10.1016/j.disc.2012.11.014">Mutually describing multisets and integer partitions</a>, Discrete Mathematics, Volume 313, Issue 4, Feb 28 2013, Pages 422-433. - From _N. J. A. Sloane_, Jan 03 2013

%H S. R. Finch, <a href="http://web.archive.org/web/20010207194413 /http://www.mathsoft.com/asolve/constant/cnwy/cnwy.html">Conway's Constant</a> [From the Wayback Machine]

%H X. Gourdon and B. Salvy, <a href="https://doi.org/10.1016/0012-365X(95)00133-H">Effective asymptotics of linear recurrences with rational coefficients</a>, Discrete Mathematics, vol. 153, no. 1-3, 1996, pages 145-163. See p. 161.

%H M. Hilgemeier, <a href="/A005150/a005150_1.pdf">Die Gleichniszahlen-Reihe</a>, in Bild der Wissenschaft, 12 (1986), 194-195, with permission from the Konradin Medien GmbH.

%H M. Hilgemeier, <a href="http://www.se16.info/mhi/">One metaphor fits all</a>, in Fractal Horizons, ed. C. A Pickover, St. Martins, NY, 1996, pp. 137-161.

%H R. A. Litherland, <a href="/A005150/a005150.html">Conway's Cosmological Theorem (Overview)</a>.

%H R. A. Litherland, <a href="/A005150/a005150_3.pdf">Conway's Cosmological Theorem</a>, 12 pages, Apr 14 2006 (pdf file)

%H R. A. Litherland, <a href="/A005150/a005150.tar.gz">Programs for Conway's Cosmological Theorem</a>, (gzipped tar ball)

%H R. A. Litherland, <a href="/A005150/a005150_4.pdf">The audioactive package</a>

%H M. Lothaire, <a href="http://www-igm.univ-mlv.fr/~berstel/Lothaire/">Algebraic Combinatorics on Words</a>, Cambridge, 2002, see p. 37, etc.

%H MacTutor History of Mathematics, <a href="https://mathshistory.st-andrews.ac.uk/Biographies/Conway/">John H. Conway</a>

%H O. Martin, <a href="http://www.jstor.org/stable/27641915">Look-and-Say Biochemistry: Exponential RNA and Multistranded DNA</a>, Amer. Math. Monthly, 113 (No. 4, 2006), 289-307. - From _N. J. A. Sloane_, Feb 19 2013

%H Thomas Morrill, <a href="https://arxiv.org/abs/2004.06414">Look, Knave</a>, arXiv:2004.06414 [math.CO], 2020.

%H Paulo Ortolan, <a href="/A005150/a005150.txt">Java program for A005150</a>

%H Rosetta Code, <a href="http://rosettacode.org/wiki/Look-and-say_sequence">Look and say sequence</a> programs in over 60 languages.

%H J. Sauerberg and L. Shu, <a href="http://www.jstor.org/stable/2974579">The long and the short on counting sequences</a>, Amer. Math. Monthly, 104 (1997), 306-317.

%H T. Sillke, <a href="http://www.mathematik.uni-bielefeld.de/~sillke/SEQUENCES/series000">Conway sequence</a>

%H L. J. Upton, <a href="/A005151/a005151.pdf">Letter to N. J. A. Sloane</a>, Jan 08 1991.

%H Kevin Watkins, <a href="http://www.cs.cmu.edu/~kw/pubs/conway.pdf">Abstract Interpretation Using Laziness: Proving Conway's Lost Cosmological Theorem</a>

%H Kevin Watkins, <a href="http://www.cs.cmu.edu/~kw/pubs/conwayslides.pdf">Proving Conway's Lost Cosmological Theorem</a>, POP seminar talk, CMU, Dec 2006.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/LookandSaySequence.html">Look and Say Sequence</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Look-and-say_sequence">Look-and-say sequence</a>

%H Wikipédia, <a href="https://fr.wikipedia.org/wiki/Suite_de_Conway">Suite de Conway</a>

%F a(n+1) = A045918(a(n)). - _Reinhard Zumkeller_, Aug 09 2012

%F a(n) = Sum_{k=1..A005341(n)} A034002(n,k)*10^(A005341(n)-k). - _Reinhard Zumkeller_, Dec 15 2012

%F a(n) = A004086(A007651(n)). - _Bernard Schott_, Jan 08 2021

%e The term after 1211 is obtained by saying "one 1, one 2, two 1's", which gives 111221.

%t RunLengthEncode[ x_List ] := (Through[ {First, Length}[ #1 ] ] &) /@ Split[ x ]; LookAndSay[ n_, d_:1 ] := NestList[ Flatten[ Reverse /@ RunLengthEncode[ # ] ] &, {d}, n - 1 ]; F[ n_ ] := LookAndSay[ n, 1 ][ [ n ] ]; Table[ FromDigits[ F[ n ] ], {n, 1, 15} ]

%t A005150[1] := 1; A005150[n_] := A005150[n] = FromDigits[Flatten[{Length[#], First[#]}&/@Split[IntegerDigits[A005150[n-1]]]]]; Map[A005150, Range[25]] (* _Peter J. C. Moses_, Mar 21 2013 *)

%o (Haskell)

%o import List

%o say :: Integer -> Integer

%o say = read . concatMap saygroup . group . show

%o where saygroup s = (show $ length s) ++ [head s]

%o look_and_say :: [Integer]

%o look_and_say = 1 : map say look_and_say

%o -- Josh Triplett (josh(AT)freedesktop.org), Jan 03 2007

%o (Haskell)

%o a005150 = foldl1 (\v d -> 10 * v + d) . map toInteger . a034002_row

%o -- _Reinhard Zumkeller_, Aug 09 2012

%o (Java) See Paulo Ortolan link.

%o (Perl)

%o $str="1"; for (1 .. shift(@ARGV)) { print($str, ","); @a = split(//,$str); $str=""; $nd=shift(@a); while (defined($nd)) { $d=$nd; $cnt=0; while (defined($nd) && ($nd eq $d)) { $cnt++; $nd = shift(@a); } $str .= $cnt.$d; } } print($str);

%o # Jeff Quilici (jeff(AT)quilici.com), Aug 12 2003

%o (Perl)

%o # This outputs the first n elements of the sequence, where n is given on the command line.

%o $s = 1;

%o for (2..shift @ARGV) {

%o print "$s, ";

%o $s =~ s/(.)\1*/(length $&).$1/eg;

%o }

%o # Arne 'Timwi' Heizmann (timwi(AT)gmx.net), Mar 12 2008

%o print "$s\n";

%o (Python) def A005150(n):

%o p = "1"

%o seq = [1]

%o while (n > 1):

%o q = ''

%o idx = 0 # Index

%o l = len(p) # Length

%o while idx < l:

%o start = idx

%o idx = idx + 1

%o while idx < l and p[idx] == p[start]:

%o idx = idx + 1

%o q = q + str(idx-start) + p[start]

%o n, p = n - 1, q

%o seq.append(int(p))

%o return seq

%o # Olivier Mengue (dolmen(AT)users.sourceforge.net), Jul 01 2005

%o (Python)

%o def A005150(n):

%o seq = [1] + [None] * (n - 1) # allocate entire array space

%o def say(s):

%o acc = '' # initialize accumulator

%o while len(s) > 0:

%o i = 0

%o c = s[0] # char of first run

%o while (i < len(s) and s[i] == c): # scan first digit run

%o i += 1

%o acc += str(i) + c # append description of first run

%o if i == len(s):

%o break # done

%o else:

%o s = s[i:] # trim leading run of digits

%o return acc

%o for i in range(1, n):

%o seq[i] = int(say(str(seq[i-1])))

%o return seq

%o # E. Johnson (ejohnso9(AT)earthlink.net), Mar 31 2008

%o (Python)

%o # program without string operations

%o def sign(n): return cmp(n, 0)

%o def say(a):

%o r = 0

%o p = 0

%o while a > 0:

%o c = 3 - sign((a % 100) % 11) - sign((a % 1000) % 111)

%o r += (10 * c + (a % 10)) * 10**(2*p)

%o a /= 10**c

%o p += 1

%o return r

%o a = 1

%o for i in range(1, 26):

%o print(i, a)

%o a = say(a)

%o # _Volker Diels-Grabsch_, Aug 18 2013

%o (Python)

%o import re

%o def lookandsay(limit, sequence = 1):

%o if limit > 1:

%o return lookandsay(limit-1, "".join([str(len(match.group()))+match.group()[0] for matchNum, match in enumerate(re.finditer(r"(\w)\1*", str(sequence)))]))

%o else:

%o return sequence

%o # lookandsay(3) --> 21

%o # _Nicola Vanoni_, Nov 29 2016

%o (PARI) A005150(n,a=1)={ while(n--, my(c=1); for(j=2,#a=Vec(Str(a)), if( a[j-1]==a[j], a[j-1]=""; c++, a[j-1]=Str(c,a[j-1]); c=1)); a[#a]=Str(c,a[#a]); a=concat(a)); a } \\ _M. F. Hasler_, Jun 30 2011

%o (Python)

%o import itertools

%o x = "1"

%o for i in range(20):

%o print(x)

%o x = ''.join(str(len(list(g)))+k for k,g in itertools.groupby(x))

%o # _Matthew Cotton_, Nov 12 2019

%Y Cf. A001155, A006751, A006715, A001140, A001141, A001143, A001145, A001151, A001154, A007651.

%Y Cf. A001387, Periodic table: A119566.

%Y Cf. A225224, A221646, A225212 (continuous versions).

%Y Apart from the first term, all terms are in A001637.

%Y About digits: A005341 (number of digits), A022466 (number of 1's), A022467 (number of 2's), A022468 (number of 3's), A004977 (sum of digits), A253677 (product of digits).

%Y About primes: A079562 (number of distinct prime factors), A100108 (terms that are primes), A334132 (smallest prime factor).

%Y Cf. A014715 (Conway's constant), A098097 (terms interpreted as written in base 4).

%K nonn,base,easy,nice

%O 1,2

%A _N. J. A. Sloane_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 10 08:09 EDT 2021. Contains 342845 sequences. (Running on oeis4.)