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-10 of 14 results. Next

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

A005151 Summarize the previous term (digits in increasing order), starting with a(1) = 1.

Original entry on oeis.org

1, 11, 21, 1112, 3112, 211213, 312213, 212223, 114213, 31121314, 41122314, 31221324, 21322314, 21322314, 21322314, 21322314, 21322314, 21322314, 21322314, 21322314, 21322314, 21322314, 21322314, 21322314, 21322314, 21322314, 21322314, 21322314, 21322314
Offset: 1

Views

Author

Keywords

Comments

a(n) = 21322314 for n > 12. - Reinhard Zumkeller, Jan 25 2014
The digits of each term a(n) are a permutation of those of the corresponding term A063850(n). - Chayim Lowen, Jul 16 2015

Examples

			The term after 312213 is obtained by saying "Two 1's, two 2's, two 3's", which gives 21-22-23, i.e., 212223.
		

References

  • C. Fleenor, "A litteral sequence", Solution to Problem 2562, Journal of Recreational Mathematics, vol. 31 No. 4 pp. 307 2002-3 Baywood NY.
  • Problem in J. Recreational Math., 30 (4) (1999-2000), p. 309.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A005150, A047842. See A083671 for another version.

Programs

  • Haskell
    import Data.List (group, sort, transpose)
    a005151 n = a005151_list !! (n-1)
    a005151_list = 1 : f [1] :: [Integer] where
       f xs = (read $ concatMap show ys) : f ys where
              ys = concat $ transpose [map length zss, map head zss]
              zss = group $ sort xs
    -- Reinhard Zumkeller, Jan 25 2014
    
  • Mathematica
    RunLengthEncode[x_List] := (Through[{Length, First}[ #1]] &) /@ Split[ Sort[x]]; LookAndSay[n_, d_:1] := NestList[ Flatten[ RunLengthEncode[ # ]] &, {d}, n - 1]; F[n_] := LookAndSay[n, 1][[n]]; Table[ FromDigits[ F[n]], {n, 25}] (* Robert G. Wilson v, Jan 22 2004 *)
    a[1] = 1; a[n_] := a[n] = FromDigits[Reverse /@ Sort[Tally[a[n-1] // IntegerDigits], #1[[1]] < #2[[1]]&] // Flatten]; Array[a, 26] (* Jean-François Alcover, Jan 25 2016 *)
  • PARI
    say(n) = {digs = digits(n); d = vecsort(digs,,8); s = ""; for (k=1, #d, nbk = #select(x->x==d[k], digs); s = concat(s, Str(nbk)); s = concat(s, d[k]);); eval(s);}
    lista(nn) = {print1(n = 1, ", "); for (k=1, nn, m = say(n); print1(m, ", "); n = m;);} \\ Michel Marcus, Feb 12 2016
    
  • PARI
    a(n,show_all=1,a=1)={for(i=2,n,show_all&&print1(a",");a=A047842(a));a} \\ M. F. Hasler, Feb 25 2018
    
  • PARI
    Vec(x*(1 + 10*x + 10*x^2 + 1091*x^3 + 2000*x^4 + 208101*x^5 + 101000*x^6 - 99990*x^7 - 98010*x^8 + 31007101*x^9 + 10001000*x^10 - 9900990*x^11 - 9899010*x^12) / (1 - x) + O(x^40)) \\ Colin Barker, Aug 23 2018
    
  • Python
    from itertools import accumulate, groupby, repeat
    def summarize(n, _):
      return int("".join(str(len(list(g)))+k for k, g in groupby(sorted(str(n)))))
    def aupton(nn): return list(accumulate(repeat(1, nn+1), summarize))
    print(aupton(25)) # Michael S. Branicky, Jan 11 2021

Formula

a(n+1) = A047842(a(n)). - M. F. Hasler, Feb 25 2018
G.f.: x*(1 + 10*x + 10*x^2 + 1091*x^3 + 2000*x^4 + 208101*x^5 + 101000*x^6 - 99990*x^7 - 98010*x^8 + 31007101*x^9 + 10001000*x^10 - 9900990*x^11 - 9899010*x^12) / (1 - x). - Colin Barker, Aug 23 2018

A177359 a(n) contains the nonzero frequencies f(d) of digits d=0 .. 9 in all terms up to a(n-1) in concatenated form sorted with respect to d: f(0)//0//f(1)//1//...//f(9)//9. Initial term a(1)=0.

Original entry on oeis.org

0, 10, 2011, 303112, 40512223, 506152331415, 60916253244516, 70111826344654619, 801519273747576171829, 9019111283849586673849, 100231122103104105106777889, 1603011521231141151161079899, 190411172143124135136117108129, 210531202173154145146137118149, 230631232203194175156157128159
Offset: 1

Views

Author

Paolo P. Lava, May 10 2010

Keywords

Comments

Zero; one zero; two zeros, one one; three zeros, three ones, one two; four zeros, five ones, two twos, two threes; five zeros, six ones, five twos, three threes, one four, one five; etc.
Also look left and say. - Robert G. Wilson v, Nov 18 2019

Crossrefs

Programs

  • Mathematica
    Nest[Append[#, FromDigits@ Flatten@ Map[IntegerDigits@ Reverse@ # &, Sort@ Tally@ Flatten@ IntegerDigits@ #]] &, {0}, 11] (* Michael De Vlieger, Nov 21 2019 *)

Extensions

More terms from Robert G. Wilson v, Nov 18 2019

A177360 a(n) contains the nonzero frequencies f(d) of digits d=0 .. 9 in all terms up to a(n-1) in concatenated form sorted with respect to d: f(0)//0//f(1)//1//...//f(9)//9. Initial term a(1)=1.

Original entry on oeis.org

1, 11, 31, 4113, 612314, 8112332416, 1113253342618, 151528344153628, 1817210364454648, 102118211310455661768, 3028110212311475962788, 50331142143124851064711819, 704111621731641051165713829, 905011821931841251468714839, 1105712022132141451569718869
Offset: 1

Views

Author

Keywords

Examples

			One; one one; three ones; four ones, one three; six ones, two threes, one four; eight ones, one two, three threes, two fours, one six; eleven ones, three twos, five threes, three fours, two sixes, one eight; etc.
		

Crossrefs

Programs

  • Mathematica
    lst = {Join[{e, 1}, Array[e &, 8]]}; Do[With[{k = Last@lst}, AppendTo[lst, ((k /. e -> 0) + With[{l = StringJoin @@ ToString /@ k}, Table[If[k[[i + 1]] =!= e, 1, 0] + StringCount[l, ToString[i]], {i, 0, 9}]]) /. {0 -> e}]], {1000}] lst = Prepend[ StringJoin @@ MapIndexed[ If[ # =!= e, ToString@# <> ToString[ #2[[1]] - 1], ""] &, # ] & /@ lst, "1"]; (* Jasper Mulder (jasper.mulder(AT)planet.nl), Jun 04 2010 *)
  • Python
    def aupton(nn):
      alst, last_str = [1], "1"
      dig_counts = [0 for i in range(10)]
      for n in range(2, nn+1):
        nxt = []
        for d in "0123456789":
          if d in last_str: dig_counts[int(d)] += last_str.count(d)
          if dig_counts[int(d)] > 0: nxt += [dig_counts[int(d)], int(d)]
        nxt_str = "".join(map(str, nxt))
        alst.append(int(nxt_str)); last_str = nxt_str
      return alst
    print(aupton(15)) # Michael S. Branicky, Jan 11 2021

Extensions

Terms corrected using values in b-file. - N. J. A. Sloane, Oct 05 2010

A177368 Count the digits of the previous terms and describe nonzero counts, digits in ascending order, concatenating the count and the digit. Initial term is 9.

Original entry on oeis.org

9, 19, 1129, 311239, 51222349, 615233141559, 91625324451669, 111826344654689, 14192737475762899, 161112839485864738129, 211132103114951065778149, 202911521231341151167788169, 3038119214314413513697108189, 50461202193174145146107138219, 80541232213214165166127148239
Offset: 1

Views

Author

Keywords

Comments

For a Mathematica program, see A177360 (you have to slightly modify it) [From Jasper Mulder (jasper.mulder(AT)planet.nl), Jun 04 2010]

Examples

			Nine; one nine; 1129=one one, two nines; 311239=three ones, one two, three nines; 51222349=five ones, two twos, two threes, four nines; six ones, five twos, three threes, one four, one five, five nines; etc.
		

Crossrefs

Extensions

Terms corrected using values in b-file. - N. J. A. Sloane, Oct 05 2010

A177363 a(n) contains the nonzero frequencies f(d) of digits d=0 .. 9 in all terms up to a(n-1) in concatenated form sorted with respect to d: f(0)//0//f(1)//1//...//f(9)//9. Initial term a(1)=4.

Original entry on oeis.org

4, 14, 1124, 311234, 51222344, 6152336415, 816253743526, 9182738455461718, 12192831047556374819, 101611121031249566576839, 30231132123134115106677859, 50301162173144135126878869
Offset: 1

Views

Author

Keywords

Comments

For a Mathematica program, see A177360 (you have to slightly modify it) [From Jasper Mulder (jasper.mulder(AT)planet.nl), Jun 04 2010]

Examples

			Four; one four; one one, two fours; three ones, one two, three fours; five ones, two twos, two threes, four fours; six ones, five twos, three threes, six fours, one five; etc.
		

Crossrefs

A177365 a(n) contains the nonzero frequencies f(d) of digits d=0 .. 9 in all terms up to a(n-1) in concatenated form sorted with respect to d: f(0)//0//f(1)//1//...//f(9)//9. Initial term a(1)=6.

Original entry on oeis.org

6, 16, 1126, 311236, 51222346, 615233141556, 916253244576, 10182634465961719, 1014192736475126271839, 20191122938485146572859, 30231162103104115156675889, 60301182133114145186777899, 80371192163134155206107108119, 120461212193144175226127128139
Offset: 1

Views

Author

Keywords

Comments

For a Mathematica program, see A177360 (you have to slightly modify it) [From Jasper Mulder (jasper.mulder(AT)planet.nl), Jun 04 2010]

Examples

			Six; one six; one one, two sixes; three ones, one two, three sixes; five ones, two twos, two threes, four sixes; six ones, five twos, three threes, one four, one five, five sixes; etc.
		

Crossrefs

Extensions

Terms corrected using values in b-file. - N. J. A. Sloane, Oct 05 2010

A177367 a(n) contains the nonzero frequencies f(d) of digits d=0 .. 9 in all terms up to a(n-1) in concatenated form sorted with respect to d: f(0)//0//f(1)//1//...//f(9)//9. Initial term a(1)=8.

Original entry on oeis.org

8, 18, 1128, 311238, 51222348, 615233141558, 91625324451668, 11182634465467819, 1519273747576179829, 181112838495866710859, 1023112293941151067715879, 30301152113104135116107168109, 80411162153114155136117178119, 90541172173134185156137198129, 100631192203154215166167218159
Offset: 1

Views

Author

Keywords

Comments

For a Mathematica program, see A177360 (you have to slightly modify it) [From Jasper Mulder (jasper.mulder(AT)planet.nl), Jun 04 2010]

Examples

			Eight; one eight; one one, two eights; three ones, one two, three eights; five ones, two twos, two threes, four eights; six ones, five twos, three threes, one four, one five, five eights; etc.
		

Crossrefs

Extensions

Terms corrected using values in b-file. - N. J. A. Sloane, Oct 05 2010

A177361 a(n) contains the nonzero frequencies f(d) of digits d=0 .. 9 in all terms up to a(n-1) in concatenated form sorted with respect to d: f(0)//0//f(1)//1//...//f(9)//9. Initial term a(1)=2.

Original entry on oeis.org

2, 12, 1122, 3142, 41521314, 7162233415, 91824344251617, 12110253743526271819, 1017114273845536472829, 20211172931147546774839, 3026120211314485561175859, 50321232133164125761277869, 603712821731741451061578879, 8043130219319416512620711889
Offset: 1

Views

Author

Keywords

Comments

For a Mathematica program, see A177360 (you have to slightly modify it) [From Jasper Mulder (jasper.mulder(AT)planet.nl), Jun 04 2010]

Examples

			Two; one two; one one, two twos; three ones, four twos; four ones, five twos, one three, one four; seven ones, six twos, two threes, three fours, one five; etc.
		

Crossrefs

Extensions

Terms corrected using values in b-file. - N. J. A. Sloane, Oct 05 2010

A177362 a(n) contains the nonzero frequencies f(d) of digits d=0 .. 9 in all terms up to a(n-1) in concatenated form sorted with respect to d: f(0)//0//f(1)//1//...//f(9)//9. Initial term a(1)=3.

Original entry on oeis.org

3, 13, 1123, 311233, 512263, 6142731516, 91528314253617, 12172103244546271819, 10171112113545556472829, 20241142123749566673839, 3027118215310410596874859, 603212021731241351061077879
Offset: 1

Views

Author

Keywords

Comments

For a Mathematica program, see A177360 (you have to slightly modify it) [From Jasper Mulder (jasper.mulder(AT)planet.nl), Jun 04 2010]

Examples

			Three; one three; one one, two threes; three ones, one two, three threes; five ones, two twos, six threes; six ones, four twos, seven threes, one five, one six; etc.
		

Crossrefs

Showing 1-10 of 14 results. Next