Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A005150
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A005150 Look and Say sequence: describe the previous term! (method A - initial term is 1).
(Formerly M4780)
+0
101
1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, 31131211131221, 13211311123113112211, 11131221133112132113212221, 3113112221232112111312211312113211 (list; graph; listen)
OFFSET

1,2

COMMENT

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

Only the digits 1, 2 and 3 appear in any term. - Robert G. Wilson v Jan 22 2004.

REFERENCES

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

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.

S. B. Ekhad and D. Zeilberger, Proof of Conway's lost cosmological theorem, Elect. Res. Announcements Amer, Math. Soc., 3 (1997), 78-82.

S. R. Finch, Mathematical Constants, Cambridge, 2003, pp. 452-455.

O. Martin, Look-and-Say Biochemistry: Exponential RNA and Multistranded DNA, Amer. Math. Monthly, 113 (No. 4, 2006), 289-307.

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.

J. Sauerberg and L. Shu, The long and the short on counting sequences, Amer. Math. Monthly, 104 (1997), 306-317.

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

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

LINKS

T. D. Noe, Table of n, a(n) for n = 1..25

Henry Bottomley, Evolution of Conway's 92 Look and Say audioactive elements

S. R. Finch, Conway's Constant

M. Hilgemeier, One metaphor fits all, in Fractal Horizons, ed. C. A Pickover, St. Martins, NY, 1996, pp. 137-161.

R. A. Litherland, The audioactive package

R. A. Litherland, Conway's cosmological theorem

M. Lothaire, Algebraic Combinatorics on Words, Cambridge, 2002, see p. 37, etc.

Paulo Ortolan, Java program for A005150

T. Sillke, Conway sequence

Eric Weisstein's World of Mathematics, Link to a section of The World of Mathematics.

D. Zeilberger, [math/9808077] Proof of Conway's Lost Cosmological Theorem

D. Zeilberger, Proof of Conway's lost cosmological theorem, Electron. Res. Announc. Amer. Math. Soc. 3 (1997), 78-82.

EXAMPLE

E.g. the term after 1211 is obtained by saying "one 1, one 2, two 1's", which gives 111221.

MATHEMATICA

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} ]

PROGRAM

(Haskell program from Josh Triplett (josh(AT)freedesktop.org), Jan 03 2007)

import List

say :: Integer -> Integer

say = read . concatMap saygroup . group . show

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

look_and_say :: [Integer]

look_and_say = 1 : map say look_and_say

(Java) See Paulo Ortolan link.

(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);

(PERL - better program from Arne 'Timwi' Heizmann (timwi(AT)gmx.net), Mar 12 2008)

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

$s = 1;

for (2..shift @ARGV) {

print "$s, ";

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

}

print "$s\n";

(Python, from Olivier Mengue (dolmen(AT)users.sourceforge.net), Jul 01 2005: replace leading dots by blanks before running)

def A005150(n):

... p = "1"

... seq = [1]

... while (n > 1):

....... q = ''

....... idx = 0 # Index

....... l = len(p) # Length

....... while idx < l:

........... start = idx

........... idx = idx + 1

........... while idx < l and p[idx] == p[start]:

............... idx = idx + 1

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

....... n, p = n - 1, q

....... seq.append(int(p))

... return seq

(A second Python program from E. Johnson (ejohnso9(AT)earthlink.net), Mar 31 2008: replace leading dots by blanks before running)

def A005150(n):

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

... def say(s):

....... acc = '' # initialize accumulator

....... while len(s) > 0:

........... i = 0

........... c = s[0] # char of first run

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

............... i += 1

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

........... if i == len(s):

............... break # done

........... else:

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

....... return acc

... for i in xrange(1, n):

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

... return seq

CROSSREFS

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

Cf. A001387. Length of n-th term = A005341. Periodic table: A119566.

Adjacent sequences: A005147 A005148 A005149 this_sequence A005151 A005152 A005153

Sequence in context: A098154 A007890 A063850 this_sequence A001388 A110393 A064263

KEYWORD

nonn,base,easy,nice

AUTHOR

njas

EXTENSIONS

Perl program from Jeff Quilici (jeff(AT)quilici.com), Aug 12 2003

page 1

Search completed in 0.004 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified May 14 01:44 EDT 2008. Contains 139663 sequences.


AT&T Labs Research