Search: id:A005150 Results 1-1 of 1 results found. %I A005150 M4780 %S A005150 1,11,21,1211,111221,312211,13112221,1113213211,31131211131221, %T A005150 13211311123113112211,11131221133112132113212221, %U A005150 3113112221232112111312211312113211 %N A005150 Look and Say sequence: describe the previous term! (method A - initial term is 1). %C A005150 Method A = 'frequency' followed by 'digit'-indication. %C A005150 Only the digits 1, 2 and 3 appear in any term. - Robert G. Wilson v Jan 22 2004. %D A005150 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %D A005150 J. H. Conway, The weird and wonderful chemistry of audioactive decay, Eureka 46 (1986) 5-16. %D A005150 J. H. Conway, The weird and wonderful chemistry of audioactive decay, in T. M. Cover and Gopinath, eds., Open Problems in Communication and Computation, Springer, NY 1987, pp. 173-188. %D A005150 S. B. Ekhad and D. Zeilberger, Proof of Conway's lost cosmological theorem, Elect. Res. Announcements Amer, Math. Soc., 3 (1997), 78-82. %D A005150 S. R. Finch, Mathematical Constants, Cambridge, 2003, pp. 452-455. %D A005150 O. Martin, Look-and-Say Biochemistry: Exponential RNA and Multistranded DNA, Amer. Math. Monthly, 113 (No. 4, 2006), 289-307. %D A005150 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 A005150 J. Sauerberg and L. Shu, The long and the short on counting sequences, Amer. Math. Monthly, 104 (1997), 306-317. %D A005150 James J. Tattersall, Elementary Number Theory in Nine Chapters, 1999, p. 23. %D A005150 I. Vardi, Computational Recreations in Mathematica. Addison-Wesley, Redwood City, CA, 1991, p. 4. %D A005150 C. A. Pickover, The Math Book, Sterling, NY, 2009; see p. 486. %H A005150 T. D. Noe, Table of n, a(n) for n = 1..25 %H A005150 Henry Bottomley, Evolution of Conway's 92 Look and Say audioactive elements %H A005150 S. R. Finch, Conway's Constant %H A005150 M. Hilgemeier, One metaphor fits all, in Fractal Horizons, ed. C. A Pickover, St. Martins, NY, 1996, pp. 137-161. %H A005150 R. A. Litherland, The audioactive package %H A005150 R. A. Litherland, Conway's cosmological theorem %H A005150 M. Lothaire, Algebraic Combinatorics on Words, Cambridge, 2002, see p. 37, etc. %H A005150 Paulo Ortolan, Java program for A005150 %H A005150 T. Sillke, Conway sequence %H A005150 Eric Weisstein's World of Mathematics, Link to a section of The World of Mathematics. %H A005150 D. Zeilberger, [math/9808077] Proof of Conway's Lost Cosmological Theorem %H A005150 D. Zeilberger, Proof of Conway's lost cosmological theorem, Electron. Res. Announc. Amer. Math. Soc. 3 (1997), 78-82. %e A005150 E.g. the term after 1211 is obtained by saying "one 1, one 2, two 1's", which gives 111221. %t A005150 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} ] %o A005150 (Haskell program from Josh Triplett (josh(AT)freedesktop.org), Jan 03 2007) %o A005150 import List %o A005150 say :: Integer -> Integer %o A005150 say = read . concatMap saygroup . group . show %o A005150 where saygroup s = (show $ length s) ++ [head s] %o A005150 look_and_say :: [Integer] %o A005150 look_and_say = 1 : map say look_and_say %o A005150 (Java) See Paulo Ortolan link. %o A005150 (PERL) #!/usr/bin/perl $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 A005150 (PERL - better program from Arne 'Timwi' Heizmann (timwi(AT)gmx.net), Mar 12 2008) %o A005150 # This outputs the first n elements of the sequence, where n is given on the command line. %o A005150 $s = 1; %o A005150 for (2..shift @ARGV) { %o A005150 print "$s, "; %o A005150 $s =~ s/(.)\1*/(length $&).$1/eg; %o A005150 } %o A005150 print "$s\n"; %o A005150 (Python, from Olivier Mengue (dolmen(AT)users.sourceforge.net), Jul 01 2005: replace leading dots by blanks before running) %o A005150 .def A005150(n): %o A005150 ... p = "1" %o A005150 ... seq = [1] %o A005150 ... while (n > 1): %o A005150 ....... q = '' %o A005150 ....... idx = 0 # Index %o A005150 ....... l = len(p) # Length %o A005150 ....... while idx < l: %o A005150 ........... start = idx %o A005150 ........... idx = idx + 1 %o A005150 ........... while idx < l and p[idx] == p[start]: %o A005150 ............... idx = idx + 1 %o A005150 ........... q = q + str(idx-start) + p[start] %o A005150 ....... n, p = n - 1, q %o A005150 ....... seq.append(int(p)) %o A005150 ... return seq %o A005150 (A second Python program from E. Johnson (ejohnso9(AT)earthlink.net), Mar 31 2008: replace leading dots by blanks before running) %o A005150 .def A005150(n): %o A005150 ... seq = [1] + [None] * (n - 1) # allocate entire array space %o A005150 ... def say(s): %o A005150 ....... acc = '' # initialize accumulator %o A005150 ....... while len(s) > 0: %o A005150 ........... i = 0 %o A005150 ........... c = s[0] # char of first run %o A005150 ........... while (i < len(s) and s[i] == c): # scan first digit run %o A005150 ............... i += 1 %o A005150 ........... acc += str(i) + c # append description of first run %o A005150 ........... if i == len(s): %o A005150 ............... break # done %o A005150 ........... else: %o A005150 ............... s = s[i:] # trim leading run of digits %o A005150 ....... return acc %o A005150 ... for i in xrange(1, n): %o A005150 ....... seq[i] = int(say(str(seq[i-1]))) %o A005150 ... return seq %Y A005150 Cf. A001155, A006751, A006715, A001140, A001141, A001143, A001145, A001151, A001154, A007651. %Y A005150 Cf. A001387. Length of n-th term = A005341. Periodic table: A119566. %Y A005150 Sequence in context: A158081 A007890 A063850 this_sequence A001388 A110393 A064263 %Y A005150 Adjacent sequences: A005147 A005148 A005149 this_sequence A005151 A005152 A005153 %K A005150 nonn,base,easy,nice %O A005150 1,2 %A A005150 N. J. A. Sloane (njas(AT)research.att.com). %E A005150 Perl program from Jeff Quilici (jeff(AT)quilici.com), Aug 12 2003 Search completed in 0.003 seconds