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 11 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

A001633 Numbers with an odd number of digits.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145
Offset: 1

Views

Author

Keywords

Comments

The lower and upper asymptotic densities of this sequence are 1/11 and 10/11, respectively. - Amiram Eldar, Feb 01 2021

Crossrefs

Cf. A001637 (complement), A055642.

Programs

Formula

A055642(a(n)) mod 2 = 1. - Reinhard Zumkeller, Jul 14 2014
Except for k = 0, if k is in this sequence, floor(log_10 k) is even; e.g., if k has three digits, 2 <= log_10 k < 3. - Alonso del Arte, Feb 03 2020

A227870 Numbers with equal number of even and odd digits.

Original entry on oeis.org

10, 12, 14, 16, 18, 21, 23, 25, 27, 29, 30, 32, 34, 36, 38, 41, 43, 45, 47, 49, 50, 52, 54, 56, 58, 61, 63, 65, 67, 69, 70, 72, 74, 76, 78, 81, 83, 85, 87, 89, 90, 92, 94, 96, 98, 1001, 1003, 1005, 1007, 1009, 1010, 1012, 1014, 1016, 1018, 1021, 1023, 1025
Offset: 1

Views

Author

Jon Perry, Nov 02 2013

Keywords

Comments

Numbers with an odd digit length cannot be in this sequence. - Alonso del Arte, Nov 02 2013

Examples

			1009 has 2 even digits (00) and 2 odd digits (19) and so is in the sequence.
		

Crossrefs

Subsequence of A001637.

Programs

  • JavaScript
    for (i = 1; i < 5000; i++) {
    s = i.toString();
    odds = 0; evens = 0;
    for (j = 0; j < s.length; j++) if (s.charAt(j)%2 == 0) evens++; else odds++;
    if (odds == evens) document.write(i + ", ");
    }
    
  • Mathematica
    Select[Range[1025], (d = Differences[Tally[Mod[IntegerDigits[#], 2]]]) != {} && d[[1, 2]] == 0 &] (* Amiram Eldar, Oct 01 2020 *)
    eneodQ[n_]:=With[{id=IntegerDigits[n]},Count[id,?(OddQ[#]&)]==Count[id,?(EvenQ[#]&)]]; Select[Range[1100],eneodQ] (* Harvey P. Dale, Jul 19 2024 *)
  • PARI
    isok(m) = my(d=digits(m)); #select(x->(x%2), d) == #select(x->!(x%2), d); \\ Michel Marcus, Oct 01 2020
    
  • Python
    def ok(i):
      stri = str(i)
      se = sum(1 for d in stri if d in "02468")
      so = sum(1 for d in stri if d in "13579")
      return se == so
    def aupto(nn):
      alst, an = [None], 0
      for n in range(1, nn+1):
        while len(alst) < nn+1:
          if ok(an): alst.append(an)
          an += 1
      return alst[1:] # use alst[n] for a(n)
    print(aupto(58))  # Michael S. Branicky, Dec 14 2020

A132285 Odd palindromes with an even number of digits.

Original entry on oeis.org

11, 33, 55, 77, 99, 1001, 1111, 1221, 1331, 1441, 1551, 1661, 1771, 1881, 1991, 3003, 3113, 3223, 3333, 3443, 3553, 3663, 3773, 3883, 3993, 5005, 5115, 5225, 5335, 5445, 5555, 5665, 5775, 5885, 5995, 7007, 7117, 7227, 7337, 7447, 7557, 7667, 7777, 7887
Offset: 1

Views

Author

Artur Jasinski, Aug 16 2007

Keywords

Crossrefs

Programs

  • Mathematica
    monQ[n_]:=Module[{len=IntegerLength[n],idn=IntegerDigits[n]},EvenQ[ len] &&Take[idn,len/2]==Reverse[Take[idn,-len/2]]]; Select[Range[11,9999,2], monQ] (* Harvey P. Dale, Apr 18 2014 *)
  • PARI
    isok(n) = {if (n % 2 == 0, return (0)); d = digits(n); if (#d % 2 == 1, return (0)); for (i=1, #d/2, if (d[i] != d[#d-i+1], return (0));); return (1);} \\ Michel Marcus, Nov 05 2013

Formula

A005408 INTERSECT A001637 INTERSECT A002113. - R. J. Mathar, Aug 22 2007

A280824 Numbers with an even number of digits and with an even number of distinct digits.

Original entry on oeis.org

10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1000, 1001, 1010
Offset: 1

Views

Author

Ilya Gutkovskiy, Jan 08 2017

Keywords

Comments

Differs from A139819 (the latter contains 100, for example). - R. J. Mathar, Jan 17 2017

Crossrefs

Programs

  • Maple
    isA280824 := proc(n)
        if n < 10 then
            return false;
        end if;
        dgs := convert(n,base,10) ;
        if type(nops(dgs),'even') then
            type(nops(convert(dgs,set)),'even') ;
        else
            false;
        end if;
    end proc: # R. J. Mathar, Jan 17 2017
  • Mathematica
    Select[Range[1010], Mod[Length[IntegerDigits[#1]], 2] == 0 && Mod[Length[Union[IntegerDigits[#1]]], 2] == 0 & ]
  • Python
    def ok(n): s = str(n); return len(s)%2 == 0 == len(set(s))%2
    print(list(filter(ok, range(1011)))) # Michael S. Branicky, Oct 12 2021

Formula

A000035(A055642(a(n))) = 0.
A000035(A043537(a(n))) = 0.
a(n) = A029742(n) for n < 82.

A280826 Numbers with an even number of digits and with an odd number of distinct digits.

Original entry on oeis.org

11, 22, 33, 44, 55, 66, 77, 88, 99, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1030, 1031, 1033, 1040, 1041, 1044, 1050, 1051, 1055, 1060, 1061, 1066, 1070, 1071, 1077, 1080, 1081, 1088, 1090, 1091, 1099, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109
Offset: 1

Views

Author

Ilya Gutkovskiy, Jan 08 2017

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Range[1110], Mod[Length[IntegerDigits[#1]], 2] == 0 && Mod[Length[Union[IntegerDigits[#1]]], 2] == 1 & ]
    endQ[n_]:=Module[{idn=IntegerDigits[n]},EvenQ[Length[idn]]&&OddQ[ Length[ Union[ idn]]]]; Select[Range[1200],endQ] (* Harvey P. Dale, Mar 31 2019 *)

Formula

A000035(A055642(a(n))) = 0.
A000035(A043537(a(n))) = 1.

A358421 Primes that are the concatenation of two primes with the same number of digits.

Original entry on oeis.org

23, 37, 53, 73, 1117, 1123, 1129, 1153, 1171, 1319, 1361, 1367, 1373, 1723, 1741, 1747, 1753, 1759, 1783, 1789, 1913, 1931, 1973, 1979, 1997, 2311, 2341, 2347, 2371, 2383, 2389, 2917, 2953, 2971, 3119, 3137, 3167, 3719, 3761, 3767, 3779, 3797, 4111, 4129, 4153, 4159, 4337, 4373, 4397, 4723, 4729
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Nov 15 2022

Keywords

Comments

It appears that there are ~ 0.81*100^k/(k^2 log^2 10) 2k-digit numbers in this sequence, making their relative density 0.9/(k^2 log^2 10) among 2k-digit numbers. Of course there are no 2k+1-digit terms in the sequence. - Charles R Greathouse IV, Nov 15 2022
The second Mathematica program below generates all 2-digit and 4-digit terms of the sequence. To generate all 2,753 6-digit terms of the sequence, use this Mathematica program: Select[1000#[[1]]+#[[2]]&/@Tuples[Prime[Range[26,168]],2],PrimeQ]. There are 112,649 8-digit terms of the sequence. - Harvey P. Dale, Feb 28 2023

Examples

			a(5) = 1117 is a term because 11 and 17 are both 2-digit primes and 1117 is prime.
		

Crossrefs

Subsequence of A000040 and of A001637.

Programs

  • Maple
    Res:= NULL: count:= 0:
    for d from 2 by 2 while count < 100 do
      pq:= 10^(d-1);
      while count < 100 do
        pq:= nextprime(pq);
        if pq > 10^d then break fi;
        q:= pq mod 10^(d/2);
        if q < 10^(d/2-1) then next fi;
        p:= (pq-q)/10^(d/2);
        if isprime(p) and isprime(q) then Res:= Res,pq; count:= count+1 fi
    od od:
    Res;
  • Mathematica
    Select[Prime[Range[640]], EvenQ[(s = IntegerLength[#])] && IntegerDigits[#][[s/2 + 1]] > 0 && And @@ PrimeQ[QuotientRemainder[#, 10^(s/2)]] &] (* Amiram Eldar, Nov 15 2022 *)
    Join[Select[FromDigits/@Tuples[Prime[Range[4]],2],PrimeQ],Select[100#[[1]]+ #[[2]]&/@ Tuples[Prime[Range[5,25]],2],PrimeQ]] (* Harvey P. Dale, Feb 28 2023 *)
  • Python
    from itertools import count, islice
    from sympy import isprime, primerange
    def agen(): # generator of terms
        for d in count(1):
            pow = 10**d
            for p in primerange(10**(d-1), pow):
                for q in primerange(10**(d-1), pow):
                    t = p*pow + q
                    if isprime(t): yield t
    print(list(islice(agen(), 51))) # Michael S. Branicky, Nov 15 2022

A375213 Even numbers with equal numbers of even and odd digits.

Original entry on oeis.org

10, 12, 14, 16, 18, 30, 32, 34, 36, 38, 50, 52, 54, 56, 58, 70, 72, 74, 76, 78, 90, 92, 94, 96, 98, 1010, 1012, 1014, 1016, 1018, 1030, 1032, 1034, 1036, 1038, 1050, 1052, 1054, 1056, 1058, 1070, 1072, 1074, 1076, 1078, 1090, 1092, 1094, 1096, 1098, 1100
Offset: 1

Views

Author

Jake L Lande, Aug 05 2024

Keywords

Comments

Numbers with an odd digit length cannot be in this sequence.

Examples

			1010 is even and has two even digits (0,0) and two odd digits (1,1).
		

Crossrefs

Subsequence of A227870 and hence A001637.
Complement of A375214 within A227870.

Programs

  • Mathematica
    eeo[n_] := (id = IntegerDigits[n]; Count[EvenQ@id, True] == Count[OddQ@id, True]); Select[Select[Range[1100], eeo], Mod[#, 2] == 0 &]

A289911 Prime vampire numbers: semiprimes x*y such that x and y have the same number of digits and the union of the multisets of the digits of x and y is the same as the multiset of digits of x*y.

Original entry on oeis.org

117067, 124483, 146137, 371893, 536539, 10349527, 10429753, 10687513, 11722657, 11823997, 12451927, 12484057, 12894547, 13042849, 14145799, 14823463, 17204359, 18517351, 18524749, 18647023, 19262587, 19544341, 19554277, 20540911, 20701957, 21874387, 30189721
Offset: 1

Views

Author

Felix Fröhlich, Jul 15 2017

Keywords

Comments

Subsequence of A014575.

Examples

			117067 = 167 * 701. A055642(117067) mod 2 = 0, A055642(167) = A055642(701) and the multiset of digits of 117067 is {0, 1, 1, 6, 7, 7}, which is also the multiset resulting from the union of the multisets of digits of 167 and 701, so 117067 is a term of the sequence.
		

Crossrefs

Programs

  • PARI
    is_a001637(n) = #Str(n)%2==0
    is_a001358(n) = omega(n)==2
    samefactorlength(v) = #Str(v[1])==#Str(v[2])
    samedigitmultiset(v) = vecsort(concat(digits(v[1]), digits(v[2])))==vecsort(digits(v[1]*v[2]))
    is(n) = if(!is_a001637(n) || !is_a001358(n) || (!issquarefree(n) && bigomega(n) > 2), return(0), my(f=factor(n)[, 1]~); if(samefactorlength(f) && samedigitmultiset(f), return(1), return(0)))
    
  • PARI
    \\ terms with n digits (if n is odd then returns terms with n + 1 digits).
    ndigits(n) = {n-=2; n+=(n%2); my(res=List()); forprime(p=ceil(10^(n/2)), 10^(n/2+1)-1, forprime(q = max(p, ceil(10^(n+1)/p)), 10^(n/2+1)-1, if(Set(vecsort(digits(p*q)) -vecsort(concat(digits(p),digits(q))))==[0], listput(res, p*q)))); listsort(res); res} \\ David A. Corneth, Jul 24 2017

A098760 Smallest a(n) not already in the sequence and not having the same length as a(n-1).

Original entry on oeis.org

0, 10, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, 9, 19, 100, 20, 101, 21, 102, 22, 103, 23, 104, 24, 105, 25, 106, 26, 107, 27, 108, 28, 109, 29, 110, 30, 111, 31, 112, 32, 113, 33, 114, 34, 115, 35, 116, 36, 117, 37, 118, 38, 119, 39, 120, 40, 121, 41, 122, 42
Offset: 0

Views

Author

Eric Angelini, Oct 01 2004

Keywords

Comments

The length of an integer is the number of its digits (10023 has length 5).
Bisections give A001633 and A001637. - David Wasserman, Feb 26 2008

Extensions

More terms from Sam Alexander, Jan 04 2005
More terms from David Wasserman, Feb 26 2008
Showing 1-10 of 11 results. Next