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 44 results. Next

A268312 First number of the periodic part of the "Say what you see" trajectory (see A005151) of n.

Original entry on oeis.org

1031223314, 21322314, 21322314, 21322314, 21322314, 3122331415, 3122331416, 3122331417, 3122331418, 3122331419, 1031223314, 21322314, 21322314, 21322314, 21322314, 3122331415, 3122331416, 3122331417, 3122331418, 3122331419, 10311233, 21322314, 22, 21322314, 31123314, 31123315
Offset: 0

Views

Author

Julien Kluge, Jan 31 2016

Keywords

Comments

a(40) is the first time the periodic part of the trajectory contains more than one term.

Examples

			Consider the starting value n = 5. We see one five: 15. We have one one and one five: 1115. We have three ones and one five: 3115... We reach 3122331415 which produces itself. So a(5) = 3122331415.
		

Crossrefs

A005151 shows a(1) at term number 13.
Cf. A047841.

Programs

  • Mathematica
    a005151[n_, m_] :=
      FromDigits[
       Reverse /@
         Sort[Tally[
           If[n == 2, m, a005151[n - 1, m]] //
            IntegerDigits], #1[[1]] < #2[[1]] &] // Flatten];
    a[n_] := Block[{previousNum = 0, currentNum = 1, knownNums = {n}},
      For[i = 2, currentNum != previousNum, ++i,
       previousNum = currentNum;
       currentNum = a005151[i, n];
       If[MemberQ[knownNums, currentNum], Return[currentNum],
        AppendTo[knownNums, currentNum]];
       ];
      Return[currentNum];
      ]
    a /@ Range[0, 100]

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

A047842 Describe n (count digits in order of increasing value, ignoring missing digits).

Original entry on oeis.org

10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1011, 21, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1012, 1112, 22, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1013, 1113, 1213, 23, 1314, 1315, 1316, 1317, 1318, 1319, 1014, 1114, 1214, 1314, 24, 1415, 1416
Offset: 0

Views

Author

Keywords

Comments

Digit count of n. The digit count numerically summarizes the frequency of digits 0 through 9 in that order when they occur in a number. - Lekraj Beedassy, Jan 11 2007
Numbers which are digital permutations of one another have the same digit count. Compare with first entries of "Look And Say" or LS sequence A045918. As in the latter, a(n) has first odd-numbered-digit entry occurring at n=1111111111 with digit count 101, but a(n) has first ambiguous term 1011. For digit count invariants, i.e., n such that a(n)=n, see A047841. - Lekraj Beedassy, Jan 11 2007

Examples

			a(31) = 1113 because (one 1, one 3) make up 31.
101 contains one 0 and two 1's, so a(101) = 1021.
a(131) = 2113.
For n = 20231231, the digits of the date 2023-12-31, last day of 2023, a(n) = 10213223 is a fixed point: a(a(n)) = a(n) (cf. A235775). Since a(n) is invariant under permutation of the digits of n (leading zeros avoided), this is independent of the chosen notation, yyyy-mm-dd or mm/dd/yyyy or dd.mm.yyyy. - _M. F. Hasler_, Jan 11 2024
		

Crossrefs

Cf. A235775.
Cf. A244112 (the same but in order of decreasing value of digits), A010785.
Cf. A005150 (Look and Say: describe the number digit-wise instead of overall count).
Cf. A328447 (least m having the same digits as n).

Programs

  • Haskell
    import Data.List (sort, group); import Data.Function (on)
    a047842 :: Integer -> Integer
    a047842 n = read $ concat $
       zipWith ((++) `on` show) (map length xs) (map head xs)
       where xs = group $ sort $ map (read . return) $ show n
    -- Reinhard Zumkeller, Jan 15 2014
    
  • Mathematica
    dc[n_] :=FromDigits@Flatten@Select[Table[{DigitCount[n, 10, k], k}, {k, 0, 9}], #[[1]] > 0 &];Table[dc[n], {n, 0, 46}] (* Ray Chandler, Jan 09 2009 *)
    Array[FromDigits@ Flatten@ Map[Reverse, Tally@ Sort@ IntegerDigits@ #] &, 46] (* Michael De Vlieger, Jul 15 2020 *)
  • PARI
    A047842(n)={if(n, local(c=1, S="", d=vecsort(digits(n)), a(i)=Str(S, c, d[i])); for(i=2, #d, if(d[i]==d[i-1], c++, S=a(i-1); c=1)); eval(a(#d)), 10)} \\ M. F. Hasler, Feb 25 2018; edited Jan 10 2024
  • Python
    def A047842(n):
        s, x = '', str(n)
        for i in range(10):
            y = str(i)
            c = str(x.count(y))
            if c != '0':
                s += c+y
        return int(s) # Chai Wah Wu, Jan 03 2015
    

Formula

a(a(n)) = A235775(n). [By definition of A235775. - M. F. Hasler, Jan 11 2024]
a(A010785(n)) = A244112(A010785(n)). - Reinhard Zumkeller, Nov 11 2014
a(n) = a(A328447(n)) = a(m) for all n and all m having the same digits as n, with multiplicity. - M. F. Hasler, Jan 11 2024

Extensions

Edited by N. J. A. Sloane, Jul 03 2008 at the suggestion of R. J. Mathar

A047841 Autobiographical numbers: Fixed under operator T (A047842): "Say what you see".

Original entry on oeis.org

22, 10213223, 10311233, 10313314, 10313315, 10313316, 10313317, 10313318, 10313319, 21322314, 21322315, 21322316, 21322317, 21322318, 21322319, 31123314, 31123315, 31123316, 31123317, 31123318, 31123319
Offset: 1

Views

Author

Ulrich Schimke (ulrschimke(AT)aol.com)

Keywords

Comments

A digit count numerically summarizes the frequency of digits 0 through 9 in that order when they occur in a number.
This uses a different method from A108810. Here the digits are described in increasing order, whereas in A108810 they can be described in any order.
This sequence is finite, since T(x) < x for every x with at least 22 digits. Last term is a(109) = 101112213141516171819. - Schimke
A character in the Verghese (2009) novel declares that 10213223 "is the only number that describes itself when you read it." - Alonso del Arte, Jan 26 2014

Examples

			10313314 contains 1 0's, 3 1's, 3 3's and 1 4's, hence T(10313314) = 10313314 is in the sequence
The entry 3122331418, for instance, is a member since it is indeed made up of three 1's, two 2's, three 3's, one 4 and one 8.
		

References

  • J. N. Kapur, Reflections of a Mathematician, Chapter 33, pp. 314-318, Arya Book Depot, New Delhi 1996.
  • Abraham Verghese, Cutting for Stone: A Novel. New York: Alfred A. Knopf (2009): 294.

Crossrefs

Cf. A005151, which is the sequence 1, T(1), T(T(1)), .. ending in the fixed-point 21322314.

Extensions

Entry revised by N. J. A. Sloane, Dec 15 2006

A063850 Say what you see in previous term, reporting total number for each digit encountered.

Original entry on oeis.org

1, 11, 21, 1211, 3112, 132112, 311322, 232122, 421311, 14123113, 41141223, 24312213, 32142321, 23322114, 32232114, 23322114, 32232114, 23322114, 32232114, 23322114, 32232114, 23322114, 32232114, 23322114, 32232114
Offset: 0

Views

Author

N. J. A. Sloane, Aug 25 2001

Keywords

Comments

The digits of each term a(n) are a permutation of those of the corresponding term A005151(n). - Chayim Lowen, Jul 16 2015

Examples

			To get the term after 311322, we say: two 3's, two 1's, two 2's, so 232122.
		

Crossrefs

A variant of A005150, A005151, etc.

Programs

  • Mathematica
    deldup[ lst_ ] := Module[ {i, s}, s={}; For[ i=1, i<=Length[ lst ], i++, If[ !MemberQ[ s, lst[ [ i ] ] ], AppendTo[ s, lst[ [ i ] ] ] ] ]; s ]; next[ term_ ] := FromDigits[ Flatten[ ({Count[ IntegerDigits[ term ], # ], #}&)/@deldup[ IntegerDigits[ term ] ] ] ]
  • Python
    from collections import Counter; s = '1'
    for _ in range(25):
        print(s, end = ', '); d = Counter(s); s = ''
        for k, v in d.items(): s += str(v) + k  # Ya-Ping Lu, Jun 06 2025

Formula

After a while sequence has period 2.

Extensions

Corrected and extended by Dean Hickerson, Aug 27 2001

A060857 Describe all the numbers already used (sorted into increasing order - not splitting numbers up into their digits).

Original entry on oeis.org

1, 11, 31, 4113, 612314, 8112332416, 1113253342618, 131528344153628111, 1617210364354648211113, 181921239445661758110311213116, 2211121431146586276829210411112313216118
Offset: 0

Views

Author

Henry Bottomley, May 03 2001

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; thirteen [note not 15] ones, five twos, eight threes, four fours, one five, three sixes, two eights, one eleven [note than numbers >9 are preserved as wholes rather than as a collection of digits]; etc.
		

Crossrefs

This is a combination of methods used in A005151 and A045982. The first word of each term (the number of ones used earlier) seems to be equal to A030711 and A030761.

Programs

  • Haskell
    import Data.List (group, sort, transpose)
    a060857 n = a060857_list !! n
    a060857_list = 1 : f [1] :: [Integer] where
       f xs = (read $ concatMap show ys) : f (xs ++ ys) where
              ys = concat $ transpose [map length zss, map head zss]
              zss = group $ sort xs
    -- Reinhard Zumkeller, Jan 25 2014
    
  • Mathematica
    FromDigits /@ Nest[Append[#, Flatten@ Map[Reverse, Tally@ Sort@ Flatten@ # ] ] &, {{1}}, 10] (* Michael De Vlieger, Jul 15 2020 *)
  • Python
    def summarize_lst(lst):
      ans = []
      for d in sorted(set(lst)): ans += [lst.count(d), d]
      return ans
    def aupton(nn):
      alst, arunninglst = [1], [1]
      for n in range(nn):
        nxt_lst = summarize_lst(arunninglst)
        arunninglst += nxt_lst
        alst.append(int("".join(map(str, nxt_lst))))
      return alst
    print(aupton(10)) # Michael S. Branicky, Jan 11 2021

A138484 Say what you see in previous term, from the right, reporting total number for each digit encountered. Initial term is 0.

Original entry on oeis.org

0, 10, 1011, 3110, 102113, 13311210, 10411223, 1322311410, 1041142322, 3213243110, 1031331422, 2214313310, 1031331422, 2214313310, 1031331422, 2214313310, 1031331422, 2214313310, 1031331422, 2214313310, 1031331422
Offset: 0

Views

Author

Keywords

Comments

After a while sequence has period 2 -> {1031331422,2214313310}

Examples

			To get the term after 102113, we say: one 3's, three 1's, one 2's, one 0's, so 13311210.
		

Crossrefs

A138493 Say what you see in previous term, from the right, reporting total number for each digit encountered. Initial term is 9.

Original entry on oeis.org

9, 19, 1911, 3119, 192113, 13311219, 19411223, 1322311419, 1941142322, 3213243119, 1931331422, 2214313319, 1931331422, 2214313319, 1931331422, 2214313319, 1931331422, 2214313319, 1931331422, 2214313319, 1931331422
Offset: 0

Views

Author

Keywords

Comments

After a while sequence has period 2 -> {1931331422,2214313319}

Examples

			To get the term after 192113, we say: one 3's, three 1's, one 2's, one 9's, so 13311219
		

Crossrefs

A221369 A two-digit Look-and-Say sequence starting with 13: each term summarizes the increasing two-digit substrings of the previous term.

Original entry on oeis.org

13, 113, 111113, 411113, 311113141, 311113114231141, 511113214123331141142, 511112113314121123131132233241142151, 711312313214115321122223124331232233241142251, 411412213214115221522423224125431432233241142143151153171
Offset: 0

Views

Author

Reinhard Zumkeller, Jan 13 2013

Keywords

Comments

a(22) is the first term containing a zero; this is due to the fact that a(21) is the first term having exactly 10 occurrences of a two-digit number, namely 10 x 42.

Examples

			a(0) = 11: 1 x 13 --> a(1) = 113;
a(1) = 113: 1 x 11 and 1 x 13 --> a(2) = 111113;
a(2) = 111113: 4 x 11 and 1 x 13 --> a(3) = 411113;
a(3) = 411113: 3 x 11, 1 x 13 and 1 x 41 --> a(4) = 311113141.
		

Crossrefs

Cf. A209234 (start=10), A209233 (start=11), A221368 (start=12), A221372 (start=19), A221373 (start=99).

Programs

  • Haskell
    -- See Link.

A023989 Look and Say sequence: describe the previous term! (method C - initial term is 2).

Original entry on oeis.org

2, 12, 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, 21322314
Offset: 0

Views

Author

Artemario Tadeu Medeiros da Silva (artemario(AT)uol.com.br), Mar 19 2002

Keywords

Comments

Method C = 'frequency' followed by 'digit'-indication with digits in increasing order.
Converges to 21322314 at the eleventh term.
Depending on the initial value, the sequence may converge to a cycle of 2 or more values, for example: 123456, 111213141516, 711213141516, 61121314151617, 71121314152617, 61221314151627, 51321314152617, 51222314251617, 41421314251617, 51221334151617, 51222314251617, 41421314251617, 51221334151617. [Corrected by Pontus von Brömssen, Jun 04 2023]
a(n) = A005151(n) for n > 6. - Reinhard Zumkeller, Jan 26 2014

Examples

			a(1) = 12, so a(2) = 1112 because 12 contains a digit 1 and a digit 2; a(3) = 3112 because 1112 contains three digits 1 and a digit 2
		

Crossrefs

Programs

  • Haskell
    import Data.List (group, sort, transpose)
    a023989 n = a023989_list !! (n-1)
    a023989_list = 2 : f [2] :: [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 26 2014

Formula

a(n) = A047842(a(n-1)). - Pontus von Brömssen, Jun 04 2023
Showing 1-10 of 44 results. Next