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 10 results.

A032917 Numbers having only digits 1 and 3 in their decimal representation.

Original entry on oeis.org

1, 3, 11, 13, 31, 33, 111, 113, 131, 133, 311, 313, 331, 333, 1111, 1113, 1131, 1133, 1311, 1313, 1331, 1333, 3111, 3113, 3131, 3133, 3311, 3313, 3331, 3333, 11111, 11113, 11131, 11133, 11311, 11313, 11331, 11333, 13111, 13113
Offset: 1

Views

Author

Keywords

Comments

Numbers n such that product of digits of n is a power of 3. - Vincenzo Librandi Aug 19 2016

Crossrefs

CF. A020451 (primes).

Programs

  • Magma
    [n: n in [1..14000] | Set(IntegerToSequence(n, 10)) subset {1, 3}]; // Vincenzo Librandi, Jun 02 2012
    
  • Mathematica
    Flatten[Table[FromDigits[#,10]&/@Tuples[{1,3},n],{n,5}]] (* Vincenzo Librandi, Jun 02 2012 *)
  • PARI
    for(n=1, 5, p=2*vector(n, i, 10^(n-i))~; forvec(d=vector(n, i, [1, 3]/2), print1(d*p,","))) \\ M. F. Hasler, Mar 10 2014
    
  • Python
    def a(n): return int(bin(n+1)[3:].replace('1', '3').replace('0', '1'))
    print([a(n) for n in range(1, 45)]) # Michael S. Branicky, May 13 2021
    
  • Python
    def A032917(n): return (int(bin(m:=n+1)[3:])<<1) + (10**(m.bit_length()-1)-1)//9 # Chai Wah Wu, Oct 13 2023

Extensions

Definition reworded by M. F. Hasler, Mar 10 2014

A199341 Primes having only {1, 3, 4} as digits.

Original entry on oeis.org

3, 11, 13, 31, 41, 43, 113, 131, 311, 313, 331, 431, 433, 443, 1433, 3313, 3331, 3343, 3413, 3433, 4111, 4133, 4441, 11113, 11131, 11311, 11411, 11443, 13313, 13331, 13411, 13441, 14143, 14341, 14411, 14431, 31333, 33113, 33311, 33331, 33343, 33413, 34141, 34313
Offset: 1

Views

Author

M. F. Hasler, Nov 05 2011

Keywords

Comments

A020451, A020452 and A020461 are subsequences. - Vincenzo Librandi, Jul 26 2015

Crossrefs

Cf. similar sequences listed in A199340.

Programs

  • Magma
    [p: p in PrimesUpTo(10^5) | Set(Intseq(p)) subset [3, 4, 1]]; // Vincenzo Librandi, Jul 26 2015
  • Maple
    Dmax:= 5: # to get all terms < 10^Dmax
    Cd:= {1,3,4}:
    C:= Cd:
    for d from 2 to Dmax do
      Cd:= map(t -> (10*t+1,10*t+3,10*t+4),Cd);
      C:= C union Cd;
    od:
    sort(convert(select(isprime,C),list)); # Robert Israel, Jul 26 2015
  • Mathematica
    Select[Prime[Range[4 10^3]], Complement[IntegerDigits[#], {3, 4, 1}]=={} &] (* Vincenzo Librandi, Jul 26 2015 *)
  • PARI
    a(n, list=0, L=[1, 3, 4], reqpal=0)={my(t); for(d=1, 1e9, u=vector(d, i, 10^(d-i))~; forvec(v=vector(d, i, [1+(i==1&!L[1]), #L]), isprime(t=vector(d, i, L[v[i]])*u)||next; reqpal & !isprime(A004086(t)) & next; list & print1(t", "); n--||return(t)))}
    

A260379 Primes having only {1, 3, 7} as digits.

Original entry on oeis.org

3, 7, 11, 13, 17, 31, 37, 71, 73, 113, 131, 137, 173, 311, 313, 317, 331, 337, 373, 733, 773, 1117, 1171, 1373, 1733, 1777, 3137, 3313, 3331, 3371, 3373, 3733, 7177, 7331, 7333, 7717, 11113, 11117, 11131, 11171, 11173, 11177, 11311, 11317, 11717, 11731, 11777
Offset: 1

Views

Author

Vincenzo Librandi, Jul 24 2015

Keywords

Crossrefs

Subsequence of A030096 and A155055. A020451, A020455, and A020463 are subsequences.
Cf. similar sequences listed in A260378.

Programs

  • Magma
    [p: p in PrimesUpTo(2*10^4) | Set(Intseq(p)) subset [1, 3, 7]];
  • Mathematica
    Select[Prime[Range[2 10^3]], Complement[IntegerDigits[#], {1, 3, 7}]=={} &]

A260224 Primes having only {1, 3, 5} as digits.

Original entry on oeis.org

3, 5, 11, 13, 31, 53, 113, 131, 151, 311, 313, 331, 353, 1151, 1153, 1511, 1531, 1553, 3313, 3331, 3511, 3533, 5113, 5153, 5333, 5351, 5531, 11113, 11131, 11311, 11351, 11353, 11551, 13151, 13313, 13331, 13513, 13553, 15131, 15313, 15331, 15511, 15551
Offset: 1

Views

Author

Vincenzo Librandi, Jul 21 2015

Keywords

Crossrefs

Subsequence of A030096. A004022, A020451, A020453, and A020462 are subsequences.
Cf. similar sequences listed in A260223.

Programs

  • Magma
    [p: p in PrimesUpTo(40000) | Set(Intseq(p)) subset [3, 5, 1]];
    
  • Mathematica
    Select[Prime[Range[3 10^3]], Complement[IntegerDigits[#], {3, 5, 1}]=={} &]
    Select[Flatten[Table[FromDigits/@Tuples[{1,3,5},n],{n,5}]],PrimeQ] (* Harvey P. Dale, Mar 03 2020 *)
  • Python
    from gmpy2 import is_prime, mpz
    from itertools import product
    A260224_list = [int(''.join(x)) for n in range(1,10) for x in product('135',repeat=n) if is_prime(mpz(''.join(x)))] # Chai Wah Wu, Jul 21 2015

A385777 Primes having only {1, 3, 6} as digits.

Original entry on oeis.org

3, 11, 13, 31, 61, 113, 131, 163, 311, 313, 331, 613, 631, 661, 1163, 1361, 1613, 1663, 3163, 3313, 3331, 3361, 3613, 3631, 6113, 6131, 6133, 6163, 6311, 6361, 6661, 11113, 11131, 11161, 11311, 11633, 13163, 13313, 13331, 13613, 13633, 16111
Offset: 1

Views

Author

Jason Bard, Jul 09 2025

Keywords

Crossrefs

Supersequence of A020451, A020454.

Programs

  • Magma
    [p: p in PrimesUpTo(10^6) | Set(Intseq(p)) subset [1, 3, 6]];
    
  • Mathematica
    Flatten[Table[Select[FromDigits /@ Tuples[{1, 3, 6}, n], PrimeQ], {n, 7}]]
  • PARI
    primes_with(,1,[1,3,6]) \\ uses function in A385776
  • Python
    print(list(islice(primes_with("136"), 41))) # uses function/imports in A385776
    

A385778 Primes having only {1, 3, 8} as digits.

Original entry on oeis.org

3, 11, 13, 31, 83, 113, 131, 181, 311, 313, 331, 383, 811, 881, 883, 1181, 1381, 1811, 1831, 3181, 3313, 3331, 3833, 3881, 8111, 8311, 8831, 11113, 11131, 11311, 11383, 11813, 11831, 11833, 13183, 13313, 13331, 13381, 13831, 13883, 18131, 18133, 18181, 18311
Offset: 1

Views

Author

Jason Bard, Jul 13 2025

Keywords

Crossrefs

Supersequence of A020451, A020456, A020464.

Programs

  • Magma
    [p: p in PrimesUpTo(10^6) | Set(Intseq(p)) subset [1, 3, 8]];
    
  • Mathematica
    Flatten[Table[Select[FromDigits /@ Tuples[{1, 3, 8}, n], PrimeQ], {n, 7}]]
  • PARI
    primes_with(, 1, [1, 3, 8]) \\ uses function in A385776
  • Python
    print(list(islice(primes_with("138"), 41))) # uses function/imports in A385776
    

A036303 Composite numbers whose prime factors contain no digits other than 1 and 3.

Original entry on oeis.org

9, 27, 33, 39, 81, 93, 99, 117, 121, 143, 169, 243, 279, 297, 339, 341, 351, 363, 393, 403, 429, 507, 729, 837, 891, 933, 939, 961, 993, 1017, 1023, 1053, 1089, 1179, 1209, 1243, 1287, 1331, 1441, 1469, 1521, 1573, 1703, 1859, 2187, 2197, 2511, 2673, 2799
Offset: 1

Views

Author

Patrick De Geest, Dec 15 1998

Keywords

Comments

All terms are a product of at least two terms of A020451. - David A. Corneth, Oct 09 2020

Examples

			The composite 117 = 3^2 * 13 is in the sequence as the digits of the prime factors are either 1 or 3. - _David A. Corneth_, Oct 17 2020
		

Crossrefs

Programs

  • Mathematica
    Select[Range[3000],CompositeQ[#]&&SubsetQ[{1,3},Union[Flatten[IntegerDigits/@FactorInteger[#][[;;,1]]]]]&] (* Harvey P. Dale, Jan 08 2025 *)
  • Python
    from sympy import factorint
    def ok(n):
        f = factorint(n)
        return sum(f.values()) > 1 and all(set(str(p)) <= set("13") for p in f)
    print(list(filter(ok, range(2800)))) # Michael S. Branicky, Sep 27 2021

Formula

Sum_{n>=1} 1/a(n) = Product_{p in A020451} (p/(p - 1)) - Sum_{p in A020451} 1/p - 1 = 0.3374936085... . - Amiram Eldar, May 18 2022

A036930 Smallest n-digit prime containing only digits 1 and 3, or 0 if no such prime exists.

Original entry on oeis.org

3, 11, 113, 3313, 11113, 113111, 1111333, 11111131, 111111113, 1111113313, 11111111113, 111111133333, 1111111111333, 11111111113133, 111111111113113, 1111111111313131, 11111111111131333, 111111111111111131
Offset: 1

Views

Author

Patrick De Geest, Jan 04 1999

Keywords

Crossrefs

Programs

  • Mathematica
    Flatten[Table[Select[FromDigits/@Tuples[{1,3},n],PrimeQ,1],{n,18}]] (* Harvey P. Dale, Jul 23 2012 *)

Extensions

Corrected by Harvey P. Dale, Jul 23 2012

A335787 Emirps containing only the digits 1 and 3.

Original entry on oeis.org

13, 31, 113, 311, 113131, 131311, 1131131, 1133131, 1133333, 1311311, 1313311, 1331333, 1333313, 3111313, 3131113, 3133331, 3331331, 3333311, 11113111, 11131111, 11311133, 11313311, 11331311, 11333131, 13131133, 13133311, 31111313, 31311113, 33111311, 33113131
Offset: 1

Views

Author

Daniel Starodubtsev, Jun 23 2020

Keywords

Crossrefs

Intersection of A006567 and A032917.
Subsequence of A020451.

Programs

  • Mathematica
    Select[Flatten[Table[FromDigits[#, 10] & /@ Tuples[{1, 3}, n], {n, 8}]], # != (r = IntegerReverse[#]) && PrimeQ[#] && PrimeQ[r] &] (* Amiram Eldar, Jun 23 2020 after Vincenzo Librandi at A032917 *)

A358020 Least prime number > prime(n) (n >= 5) whose set of decimal digits coincides with the set of decimal digits of prime(n), or -1 if no such prime exists.

Original entry on oeis.org

1111111111111111111, 31, 71, 191, 223, 229, 113, 73, 4111, 433, 4447, 353, 599, 661, 677, 1117, 337, 97, 383, 8999, 797, 10111, 1013, 701, 1009, 131, 271, 311, 173, 193, 419, 1151, 571, 613, 617, 317, 197, 811, 199, 1193, 719, 911, 2111, 233, 277, 929, 2333, 293, 421, 521, 2557
Offset: 5

Views

Author

Jean-Marc Rebert, Oct 24 2022

Keywords

Examples

			prime(6) = 13 and the prime number 31 have the same set of digits {1,3}, and 31 is the smallest such number, hence a(6) = 31.
prime(13) = 41 and the prime number 4111 have the same set of digits {1,4}, and 4111 is the smallest such number, hence a(13) = 4111.
prime(20) = 71 and the prime number 1117 have the same set of digits {1,7}, and 1117 is the smallest such number, hence a(20) = 1117.
		

Crossrefs

Programs

  • Maple
    N:= 60: # for a(5)..a(N)
    A:= Array(5..N):
    R:= 1111111111111111111:
    A[5]:= R: count:= 1:
    for k from 6 while count < N-4 do
      p:= ithprime(k);
      S:= convert(convert(p,base,10),set);
      if assigned(V[S]) and V[S]<=N then A[V[S]]:= p; count:=count+1;  fi;
      V[S]:= k;
    od:
    convert(A,list); # Robert Israel, Oct 25 2022
  • PARI
    a(n)=my(m=Set(digits(prime(n)))); if(n<5, return()); if(n==5,return(1111111111111111111));forprime(p=prime(n+1), , if(Set(digits(p))==m, return(p)))
    
  • Python
    from sympy import isprime, prime
    from itertools import count, product
    def a(n):
        pn = prime(n)
        s = str(pn)
        for d in count(len(s)):
            for p in product(set(s), repeat=d):
                if p[0] == "0": continue
                t = int("".join(p))
                if t > pn and isprime(t):
                    return t
    print([a(n) for n in range(5, 56)]) # Michael S. Branicky, Oct 25 2022
Showing 1-10 of 10 results.