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-9 of 9 results.

A049194 Number of digits in n-th term of A001387.

Original entry on oeis.org

1, 2, 3, 6, 8, 12, 18, 27, 39, 58, 85, 125, 183, 269, 394, 578, 847, 1242, 1820, 2668, 3910, 5731, 8399, 12310, 18041, 26441, 38751, 56793, 83234, 121986, 178779, 262014, 384000, 562780, 824794, 1208795, 1771575, 2596370, 3805165, 5576741
Offset: 1

Views

Author

Keywords

References

  • Peter A. Hendriks, "A binary variant of Conway's audioactive sequence", lecture at 1192nd meeting of WWWW, Groningen, The Netherlands (Jul 15 1999).

Crossrefs

Programs

  • Mathematica
    CoefficientList[Series[(1+x+x^3-x^4-x^5)/(1-x-x^2+x^5),{x,0,50}],x] (* Peter J. C. Moses, Jun 21 2013 *)
  • PARI
    a(n) = if (n==3, 3, if (n==4, 6, floor((8/9 + (1/18)*(748 - 36*sqrt(93))^(1/3) + (1/18)*(748 + 36*sqrt(93))^(1/3)) * (1/3 + (1/6)*(116 - 12*sqrt(93))^(1/3) + (1/6)*(116 + 12*sqrt(93))^(1/3))^(n-1)))) \\ Michel Marcus, Mar 04 2013
    
  • PARI
    a(n) = my(v=vector(n), u=[1,2,3,6]); if(n<=4, u[n], for(i=1, 4, v[i]=u[i]); for(i=5, n, v[i]=v[i-1]+v[i-3]+!(i%2)); v[n]) \\ Jianing Song, Apr 28 2019

Formula

a(n) = (8/9 + (1/18)*(748 - 36*sqrt(93))^(1/3) + (1/18)*(748 + 36*sqrt(93))^(1/3)) * (1/3 + (1/6)*(116 - 12*sqrt(93))^(1/3) + (1/6)*(116 + 12*sqrt(93))^(1/3))^(n-1).
The number of digits is equal to c*l^n rounded down to the nearest integer, where c and l are the real roots of 3x^3 - 8x^2 + 5x - 1 and x^3 - x^2 - 1 respectively, for all n except n = 2 and n = 3.
From Jianing Song, Apr 28 2019: (Start)
a(n) = a(n-1) + a(n-2) - a(n-5) for n >= 7. [Derived from the T. Sillke link above.]
a(n) = a(n-1) + a(n-3) if n is odd, a(n-1) + a(n-3) + 1 if n is even, n >= 5 (this does not hold for n = 4).
Limit_{n->oo} a(n)/A001609(n) = c, where c = 1.276742... is the unique real root of 3x^3 - 4x^2 + x - 1. (End)

Extensions

More terms and formulas supplied by Gerton Lunter (gerton(AT)math.rug.nl)

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

A049190 Start with 1. Convert to base 2, describe it in base 2, convert to base 10. Repeat with the new result.

Original entry on oeis.org

1, 3, 5, 59, 245, 2491, 235253, 127756731, 330567489269, 258479716298484155, 36823182192123209878050549, 25576412117054296344209353299113896379, 10994511204169842163496446583221775727830456269734123253
Offset: 1

Views

Author

Keywords

Comments

a(n) is A001387(n) converted to base 10. - Nathan Fox, Mar 07 2018
"Describe" means to apply the "look-and-say" function (cf. A045918), but the "count" is again expressed in binary (and concatenated with the digit), cf. examples. - M. F. Hasler, Jul 12 2025

Examples

			1 -> one 1 -> 11 -> 3;
3 -> 11 -> two 1s -> 101 -> 5;
5 -> 101 -> one 1, one 0, one 1 -> 111011 -> 59;
etc.
		

Crossrefs

Programs

  • PARI
    A049190_first(N=13)=vector(N, i, N=if(i>1, my(d=binary(N), j=0); d=concat(d[^1]-d[^-1],-1); fromdigits(concat([concat(binary(-j+j=n), d[n]<0) | n<-[1..#d], d[n]]), 2), 1)) \\ M. F. Hasler, Jul 12 2025

Extensions

Definition and Example corrected by Nathan Fox, Mar 07 2018

A001391 To get the 3rd term, for example, note that 2nd term has three (11 in binary!) 1's and one (1) 0, giving 11 1 1 0.

Original entry on oeis.org

10, 1110, 11110, 100110, 1110010110, 111100111010110, 100110011110111010110, 1110010110010011011110111010110, 1111001110101100111001011010011011110111010110
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A001387.

A049064 Describe the previous term in binary (method A - initial term is 0).

Original entry on oeis.org

0, 10, 1110, 11110, 100110, 1110010110, 111100111010110, 100110011110111010110, 1110010110010011011110111010110, 1111001110101100111001011010011011110111010110, 1001100111101110101100111100111010110111001011010011011110111010110
Offset: 1

Views

Author

Keywords

Comments

Method A = 'frequency' (in binary mode) followed by 'digit'-indication.
The number of digits of a(n) is A001609(n) except for n = 2. See the link from T. Sillke below. - Jianing Song, Mar 16 2019

Examples

			E.g., the term after 11110 is obtained by saying "four (i.e., 100 in binary mode) 1, one 0", which gives 100110.
		

Crossrefs

Cf. A001387 (initial term is 1), A001391, A001609 (number of digits), A259710 (written in decimal).
Decimal look-and-say sequences: A005150, A006751, A006715, A001140, A001141, A001143, A001145, A001151, A001154.

Formula

a(n) = A001391(n-1), n > 1. - R. J. Mathar, Oct 15 2008

Extensions

Edited by Charles R Greathouse IV, Apr 06 2010
a(11) from Kade Robertson, Jun 24 2015
Offset corrected by Jianing Song, Mar 16 2019

A320890 a(1) = 11. For all subsequent terms a(n), take a(n-1) and substitute for the k-th digit the binary number of times that digit has appeared in a(n-1), reading left to right from the 1st to k-th digit.

Original entry on oeis.org

11, 110, 1101, 110111, 110111100101, 11011110010111010111111001000, 1101111001011101011111100100010011010101101111011001101111011111000010001111100010010100110101011
Offset: 1

Views

Author

Thomas Anton, Oct 23 2018

Keywords

Comments

Each term is an initial segment of all of its successors.
There are always more 1's than 0's in a term.
The proportion of 0's or 1's in the n-th term approaches 1/2 as n approaches infinity.
Starting with any binary integer apart from 0 or 1 and applying the same process to yield a sequence s(n), we have that, for a sufficiently large x, a(n) is always an initial segment of s(n+x). The constancy and uniqueness of the limiting behavior of initial segments in base 2 is unique among all bases, unless the tally system is considered as a degenerate case.

Examples

			a(1) = 11
The first 1 is replaced with 1, and the second 1 is replaced with 10 (two), so a(2) = 110 (1|10)
The first 1 is replaced with 1, the second 1 with 10, and the first 0 with 1, so a(3) = 1101 (1|10|1)
The first 1 is replaced with 1, the second 1 with 10, the first 0 with 1, and the third 1 with 11 (three), so a(4) = 110111 (1|10|1|11)
The first 1 is replaced with 1, the second 1 with 10, the first 0 with 1, the third 1 with 11, the fourth 1 with 100, and the fifth 1 with 101, so a(5) = 110111100101 (1|10|1|11|100|101)
The first 1 is replaced with 1, the second 1 with 10, the first 0 with 1, the third 1 with 11, the fourth 1 with 100, the fifth 1 with 101, the sixth 1 with 110, the second 0 with 10, the third 0 with 11, the seventh 1 with 111, the fourth 0 with 100, and the eighth 1 with 1000, so a(6) = 11011110010111010111111001000 (1|10|1|11|100|101|110|10|11|111|100|1000)
		

Crossrefs

Programs

  • Mathematica
    FromDigits /@ Nest[Append[#, Flatten[IntegerDigits[#, 2] & /@ Table[Count[#, Last@ #] &@ #[[1 ;; k]], {k, Length@ #}]] &[#[[-1]] ] ] &, {{1, 1}}, 6] (* Michael De Vlieger, Oct 23 2018 *)
  • PARI
    eva(n) = subst(Pol(n), x, 10)
    replace(v) = my(w=[], zeros=0, ones=0); for(k=1, #v, if(v[k]==0, zeros++; w=concat(w, binary(zeros))); if(v[k]==1, ones++; w=concat(w, binary(ones)))); w
    terms(n) = my(v=[1, 1], i=0); while(i < n, print1(eva(v), ", "); i++; v=replace(v))
    /* Print initial 7 terms as follows: */
    terms(7) \\ Felix Fröhlich, Oct 23 2018
    
  • Python
    A320890_list = [11]
    while len(A320890_list)<10:
        a0,a1,s = 0,0,''
        for d in str(A320890_list[-1]):
            if d == '0':
                a0 += 1
                s += bin(a0)[2:]
            else:
                a1 += 1
                s += bin(a1)[2:]
        A320890_list.append(int(s)) # Chai Wah Wu, Nov 30 2018

A356329 Binary Look and Say sequence (method B - initial term is 1).

Original entry on oeis.org

1, 11, 110, 11001, 11001011, 1100101101110, 11001011011100111101, 11001011011100111101011000111, 1100101101110011110101100011101110011111, 1100101101110011110101100011101110011111011110101101
Offset: 1

Views

Author

Szumi Xie, Sep 18 2022

Keywords

Comments

Method B = 'digit'-indication followed by 'frequency' in binary.
It is not true that every term is a prefix of the following term; the first counterexample is at the 15th term.
It appears that the lengths of the common prefixes between adjacent terms strictly increase.

Examples

			The term after 11001 is obtained by saying "1 twice (10 in binary), 0 twice (10) and 1 once (1)", giving 1 10 0 10 1 1.
		

Crossrefs

Programs

  • Haskell
    import Data.List (group)
    import Numeric (showBin)
    a356329 n = a356329_list !! (n - 1)
    a356329_list = read <$> iterate (concat . concatMap (\x -> [take 1 x, showBin (length x) ""]) . group) "1" :: [Integer]
    
  • Mathematica
    a[1]=1; a[n_] := a[n]=Block[{s = Split@ IntegerDigits@ a[n-1]}, FromDigits@ Flatten@ Transpose[{First /@ s, IntegerDigits[ Length /@ s, 2]}]]; Array[a, 10] (* Giovanni Resta, Oct 05 2022 *)
  • Python
    from itertools import accumulate, groupby, repeat
    def summarize(n, _): return int("".join(k+bin(len(list(g)))[2:] for k, g in groupby(str(n))))
    def aupto(terms): return list(accumulate(repeat(1, terms), summarize))
    print(aupto(11)) # Michael S. Branicky, Sep 18 2022

A363054 Look and say sequence: describe the previous term (method A, starting with 20).

Original entry on oeis.org

20, 1210, 11121110, 31123110, 132112132110, 11131221121113122110, 311311222112311311222110, 1321132132211213211321322110, 11131221131211132221121113122113121113222110, 3113112221131112311332211231131122211311123113322110
Offset: 1

Views

Author

Julia Zimmerman, May 15 2023

Keywords

Examples

			The term after 1210 is given by saying "I see one 1, one 2, one 1, and one 0", and then writing down the digits as 11-12-11-10, yielding 11121110.
		

Crossrefs

Programs

  • Mathematica
    NestList[FromDigits@ Flatten@ Map[Reverse@ Tally[#][[1]] &, Split@ IntegerDigits[#] ] &, 20, 12] (* Michael De Vlieger, Jul 05 2023 *)
  • Python
    from itertools import count, groupby, islice
    def LS(n): return int(''.join(str(len(list(g)))+k for k, g in groupby(str(n))))
    def agen(an=20): yield an; yield from (an:=LS(an) for n in count(1))
    print(list(islice(agen(), 10))) # Michael S. Branicky, May 15 2023

A260387 Numbers n = d_0d_1...d_n (n < 10) such that d_i is the number of digits equal to i in n (base b), where b is less than 10.

Original entry on oeis.org

12, 13, 320, 3201, 72200, 89000, 132110, 345000, 643000, 2320200, 3121300, 10103111, 11300130, 42430000, 51340000, 64030000, 72300000, 86300000, 125102000, 130213000, 211220001, 220101111, 323111000, 431130000, 614110000, 667000000, 2153100000, 2521002000, 3021211100
Offset: 1

Views

Author

Pieter Post, Jul 24 2015

Keywords

Comments

The only terms having the same number of digits as the base are 13, 10103111, 211220001 and 220101111. For example, 13 is 1101_2, which has 1 zero and 3 ones.
The least term with 10 digits that describes itself is 2153100000.
2153100000 is 104233022322_7, so it has 2 zeros, 1 one, 5 twos, 3 threes, 1 four, 0 fives, 0 sixes, 0 sevens, 0 eights and 0 nines in base 7.

Examples

			12 = 110_3, which has 1 zero and 2 ones.
13 = 1101_2, which has 1 zero and 3 ones.
320 = 11000_4, which has 3 zeros, 2 ones and 0 twos.
3201 = 100301_5, which has 3 zeros, 2 ones, 0 twos and 1 three.
72200 = 10200001002_3
89000 = 10101101110101000_2
132110 = 13211420_5
345000 = 122112020210_3
643000 1012200000211_3
42430000 = 2201312320300_4
51340000 = 3003312023200_4
64030000 = 3310100110300_4
72300000 = 122002100000_5
86300000 = 20000101111100022_3
431130000 = 110440340120_6
614110000 = 2224203010000_5
667000000 = 1201111002002222201_3
2153100000 = 104233022322_7
		

Crossrefs

Extensions

a(10)-a(13), a(19)-a(23), a(28)-a(29) added by Giovanni Resta, Jul 26 2015
Showing 1-9 of 9 results.