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.

Showing 1-5 of 5 results.

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

Original entry on oeis.org

1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, 31131211131221, 13211311123113112211, 11131221133112132113212221, 3113112221232112111312211312113211, 1321132132111213122112311311222113111221131221, 11131221131211131231121113112221121321132132211331222113112211, 311311222113111231131112132112311321322112111312211312111322212311322113212221
Offset: 1

Views

Author

Keywords

Comments

Method A = "frequency" followed by "digit"-indication.
Also known as the "Say What You See" sequence.
Only the digits 1, 2 and 3 appear in any term. - Robert G. Wilson v, Jan 22 2004
All terms end with 1 (the seed) and, except the third a(3), begin with 1 or 3. - Jean-Christophe Hervé, May 07 2013
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
This sequence is called "suite de Conway" in French (see Wikipédia link). - Bernard Schott, Jan 10 2021
Contrary to many accounts (including an earlier comment on this page), Conway did not invent the sequence. The first mention of the sequence appears to date back to the 1977 International Mathematical Olympiad in Belgrade, Yugoslavia. See the Editor's note on page 4, directly preceding Conway's article in Eureka referenced below. - Harlan J. Brothers, May 03 2024

Examples

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

References

  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See p. 208.
  • S. R. Finch, Mathematical Constants, Cambridge, 2003, section 6.12 Conway's Constant, pp. 452-455.
  • M. Gilpin, On the generalized Gleichniszahlen-Reihe sequence, Manuscript, Jul 05 1994.
  • A. Lakhtakia and C. Pickover, Observations on the Gleichniszahlen-Reihe: An Unusual Number Theory Sequence, J. Recreational Math., 25 (No. 3, 1993), 192-198.
  • Clifford A. Pickover, Computers and the Imagination, St Martin's Press, NY, 1991.
  • 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.
  • C. A. Pickover, The Math Book, Sterling, NY, 2009; see p. 486.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • 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.

Crossrefs

Cf. A001387, Periodic table: A119566.
Cf. A225224, A221646, A225212 (continuous versions).
Apart from the first term, all terms are in A001637.
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).
About primes: A079562 (number of distinct prime factors), A100108 (terms that are primes), A334132 (smallest prime factor).
Cf. A014715 (Conway's constant), A098097 (terms interpreted as written in base 4).

Programs

  • Haskell
    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
    -- Josh Triplett (josh(AT)freedesktop.org), Jan 03 2007
    
  • Haskell
    a005150 = foldl1 (\v d -> 10 * v + d) . map toInteger . a034002_row
    -- Reinhard Zumkeller, Aug 09 2012
    
  • Java
    See Paulo Ortolan link.
    
  • 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} ]
    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 *)
  • 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
  • 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);
    # Jeff Quilici (jeff(AT)quilici.com), Aug 12 2003
    
  • Perl
    # 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;
    }
    # Arne 'Timwi' Heizmann (timwi(AT)gmx.net), Mar 12 2008
    print "$s\n";
    
  • Python
    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
    # Olivier Mengue (dolmen(AT)users.sourceforge.net), Jul 01 2005
    
  • Python
    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 range(1, n):
            seq[i] = int(say(str(seq[i-1])))
        return seq
    # E. Johnson (ejohnso9(AT)earthlink.net), Mar 31 2008
    
  • Python
    # program without string operations
    def sign(n): return int(n > 0)
    def say(a):
        r = 0
        p = 0
        while a > 0:
            c = 3 - sign((a % 100) % 11) - sign((a % 1000) % 111)
            r += (10 * c + (a % 10)) * 10**(2*p)
            a //= 10**c
            p += 1
        return r
    a = 1
    for i in range(1, 26):
        print(i, a)
        a = say(a)
    # Volker Diels-Grabsch, Aug 18 2013
    
  • Python
    import re
    def lookandsay(limit, sequence = 1):
        if limit > 1:
            return lookandsay(limit-1, "".join([str(len(match.group()))+match.group()[0] for matchNum, match in enumerate(re.finditer(r"(\w)\1*", str(sequence)))]))
        else:
            return sequence
    # lookandsay(3) --> 21
    # Nicola Vanoni, Nov 29 2016
    
  • Python
    import itertools
    x = "1"
    for i in range(20):
        print(x)
        x = ''.join(str(len(list(g)))+k for k,g in itertools.groupby(x))
    # Matthew Cotton, Nov 12 2019
    

Formula

a(n+1) = A045918(a(n)). - Reinhard Zumkeller, Aug 09 2012
a(n) = Sum_{k=1..A005341(n)} A034002(n,k)*10^(A005341(n)-k). - Reinhard Zumkeller, Dec 15 2012
a(n) = A004086(A007651(n)). - Bernard Schott, Jan 08 2021
A055642(a(n+1)) = A005341(n+1) = 2*A043562(a(n)). - Ya-Ping Lu, Jan 28 2025
Conjecture: DC(a(n)) ~ k * (Conway's constant)^n where k is approximately 1.021... and DC denotes the number of digit changes in the decimal representation of n (e.g., DC(13112221)=4 because 1->3, 3-1, 1->2, 2->1). - Bill McEachen, May 09 2025
Conjecture: lim_{n->infinity} (c2+c3-c1)/(c1+c2+c3) = 0.01 approximately, where ci is the number of appearances of 'i' in a(n). - Ya-Ping Lu, Jun 05 2025

A213979 Conway's 92 Look and Say audioactive elements, generated in lexicographic order.

Original entry on oeis.org

1112, 1112133, 111213322112, 111213322113, 1113, 11131, 111311222112, 111312, 11131221, 1113122112, 1113122113, 11131221131112, 111312211312, 11131221131211, 111312211312113211, 111312211312113221133211322112211213322112
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 09 2012

Keywords

References

  • 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.

Crossrefs

Programs

  • Haskell
    see Haskell link.

A215403 Isotopes of Conway's audioactive transuranic elements, in reversed lexicographic order.

Original entry on oeis.org

312211322212221121123222114, 13112221133211322112211213322114, 312211322212221121123222115, 13112221133211322112211213322115, 312211322212221121123222116, 13112221133211322112211213322116, 312211322212221121123222117, 13112221133211322112211213322117
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 09 2012

Keywords

Comments

The transuranic elements Pu=31221132221222112112322211 and Np=1311222113321132211221121332211 are alternating prefixes;
n is suffix of a(2*n - 1) and of a(2*n) in decimal representation.

Crossrefs

Programs

  • Haskell
    a215403 n k = a215403_list !! (n-1)
    a215403_list = map (foldr (\d v -> 10 * v + d) 0) $
                       concatMap (\x -> map (x :) [plut', nept']) [4..] where
      plut' = [1,1,2,2,2,3,2,1,1,2,1,1,2,2,2,1,2,2,2,3,1,1,2,2,1,3]
      nept' = [1,1,2,2,3,3,1,2,1,1,2,2,1,1,2,2,3,1,1,2,3,3,1,1,2,2,2,1,1,3,1]

A334055 Iteration count (or -1) corresponding to A334054(n).

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 4, 10, 3, 1, 1, 1, 1, 3, 1, 3, 7, 2, 9, 3, 1, 7, 3, 3, 4, -1, 3, 3, -1, 4, 1, -1, 5, 9, -1, -1, 7, 3, 1, 2, 3, 1, 5, 9, 5, -1, 3, 1, 4, 3, 3, 4, -1, 3, 4, -1, 3, 1, -1, 5, 7, -1, 3, 1, 1, -1, 2, 9, 11, 3, 8, 4, 10, 3, 4, -1, -1, 3, -1, -1, 3, 3, -1, 8, 10
Offset: 1

Views

Author

Scott R. Shannon, Sep 07 2020

Keywords

Comments

This is the number of iterations for the starting number, containing only digits 1,2 and 3 (see A007932) to reappear in the iterative cycle of its own 'Look and Say' description.
See A334054 for further details, a list of the number that do reappear in their iterative cycle, and a proof that the number 233 can never reappear in its cycle.
For all 1092 numbers up to six digits long containing digits 1,2,3 there are 397 numbers which reappear in their own iterative cycle, while 695 do not and can be proven never will.
In the same range, numbers 121322 and 213223 take 33 cycles before reappearing. The final string in the later case has 49470 digits. See the link file for details of the other numbers.

Examples

			The numbers containing only digits 1,2 and 3 are given in A007932.
a(1) = 1 as the number 1 take one iteration to reappear: 1->11 which contains '1' as a substring.
a(4) = 2 as the number 11 takes two iterations to reappear: 11->21->1211 which contains '11' as a substring.
a(9) = 3 as the number 23 takes three iterations to reappear: 23->1213->11121113->31123113 which contains '23' as a substring.
a(11) = 4 as the number 32 takes four iterations to reappear: 32->1312->11131112->31133112->1321232112 which contains '32' as a substring.
a(12) = 10 as the number 33 takes ten iterations to reappear: 33->23->1213->11121113->31123113->132112132113->11131221121113122113->311311222112311311222113->1321132132211213211321322113->11131221131211132221121113122113121113222113->3113112221131112311332211231131122211311123113322113 which contains '33' as a substring.
		

Crossrefs

A334054 Lexicographically earliest numbers containing only digits 1,2,3 that appear again in the iterative cycle of their own 'Look and Say' description (Cf. A005150).

Original entry on oeis.org

1, 2, 3, 11, 12, 13, 21, 22, 23, 31, 32, 33, 111, 112, 113, 121, 122, 123, 131, 132, 133, 211, 212, 213, 221, 222, 223, 231, 232, 311, 312, 321, 322, 331, 332, 1112, 1113, 1121, 1122, 1123, 1131, 1132, 1133, 1211, 1213, 1221, 1222, 1223, 1231, 1232, 1311, 1312, 1321, 1322, 1331, 1332, 2111
Offset: 1

Views

Author

Scott R. Shannon, Sep 07 2020

Keywords

Comments

Take a number that contains only digits 1,2,3 and then describe the given number with its 'Look and Say' string, see A005150. Repeat this process until the starting number appears in the resulting string. The sequence lists the numbers that eventually reappear.
A334055 gives the number of iterations for the starting number to reappear and details of the final string for all recurrent numbers.
The number 233 is the first number that does not appear in its iterative Look and Say cycle. See examples below.

Examples

			1 is a term as the Look and Say description of 1 is '11', which contains '1' as a substring.
111 is a term as the Look and Say description of 111 is '31'. Repeating this process leads to '1311' and then '111321', which contains '111' as a substring.
1112 is a term as the Look and Say description of 1112 is '3112'. Repeating this process leads to '132112', '1113122112', '311311222112', '13211321322112', '1113122113121113222112', and then '31131122211311123113322112', which contains '1112' as a substring.
233 is not a term. If it were, it would have to have a parent string that could produce 233 from its Look and Say description, and one can show that that is not possible. The '33' part cannot be interpreted as 'three 3's' as '333' cannot be inside the parent string. To prove that, consider that the string '333' can be interpreted in two ways. 1. "x number of 3's followed by three 3's" which is not possible as that would be written as "x+three 3's". 2. "three 3's followed by three x's", where x cannot be a 3, else it would be written as "six 3's". So it has to be either '333111' or '333222'. But the first case has to be interpreted as either "x 3's followed by three 3's followed by one 1 ..." which is not possible as that would be written as "x+three 3's", else it has to be interpreted as "three 3's followed by three 1's followed by one 1", which is not possible as that would be written as "... four 1's". Likewise for '333222', hence '333' has no valid parent string. Therefore '233' must be interpreted as "two 3's followed by 3 x's", where the x's cannot be 3's. Thus the two possible strings are '33111' or '33222'. But the '33' part of these strings cannot be "three 3's" as shown, so the first string has to be interpreted as "x 3's followed by three 1's followed by one 1", but that is not possible as the 1's would be combined. Similarly for the second string. Hence '233' has no parent string, thus it cannot reappear in the iterative process of this sequence.
A similar argument can prove that numbers like 313, 323, 1111, 2232, 2313, and with more effort, 22213, 112321, 213321, do not have any parent string and thus do not appear in this sequence.
		

Crossrefs

Showing 1-5 of 5 results.