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

A080608 Deletable primes: primes such that removing some digit leaves either the empty string or another deletable prime (possibly preceded by some zeros).

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 23, 29, 31, 37, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97, 103, 107, 113, 127, 131, 137, 139, 157, 163, 167, 173, 179, 193, 197, 223, 229, 233, 239, 263, 269, 271, 283, 293, 307, 311, 313, 317, 331, 337, 347, 353, 359, 367, 373, 379, 383, 397, 431, 433, 439
Offset: 1

Views

Author

David W. Wilson, Feb 25 2003

Keywords

Comments

Subsequence of A179336. - Reinhard Zumkeller, Jul 11 2010
Leading zeros are allowed in the number that appears after the digit is deleted. For example the prime 100003 is deletable because of the sequence 00003, 0003, 003, 03, 3 consists of primes. Because of this, it appears that deletable primes are relatively common in the region just above a power of ten. For example 10^1000 + 2713 is a deletable prime. - Jeppe Stig Nielsen, Aug 01 2018
For a version that does not allow leading zeros, see A305352. - Jeppe Stig Nielsen, Aug 01 2018

Examples

			410256793 is a deletable prime since each member of the sequence 410256793, 41256793, 4125673, 415673, 45673, 4567, 467, 67, 7 is prime (Weisstein, Caldwell).
		

Crossrefs

Programs

  • Maple
    read("transforms"):
    isA080608 := proc(n)
        option remember;
        local dgs,i ;
        if isprime(n) then
            if n < 10 then
                true;
            else
                dgs := convert(n,base,10) ;
                for i from 1 to nops(dgs) do
                    subsop(i=NULL,dgs) ;
                    digcatL(ListTools[Reverse](%)) ;
                    if procname(%)  then
                        return true;
                    end if;
                end do:
                false ;
            end if;
        else
            false;
        end if;
    end proc:
    n := 1;
    for i from 1 to 500 do
        p := ithprime(i) ;
        if isA080608(p) then
            printf("%d %d\n",n,p) ;
            n := n+1 ;
        fi ;
    end do: # R. J. Mathar, Oct 11 2014
  • Mathematica
    Rest@ Union@ Nest[Function[{a, p}, Append[a, With[{w = IntegerDigits[p]}, If[# == True, p, 0] &@ AnyTrue[Array[FromDigits@ Delete[w, #] &, Length@ w], ! FreeQ[a, #] &]]]] @@ {#, Prime[Length@ # + 1]} &, Prime@ Range@ PrimePi@ 10, 81] (* Michael De Vlieger, Aug 02 2018 *)
  • PARI
    is(n) = !ispseudoprime(n)&&return(0);my(d=digits(n));#d==1&&return(1);for(i=1,#d,is(fromdigits(vecextract(d,Str("^"i))))&&return(1));0 \\ Jeppe Stig Nielsen, Aug 01 2018
    
  • Perl
    use ntheory ":all"; sub is { my $n=shift; return 0 unless is_prime($n); my @d=todigits($n); return 1 if @d==1; is(fromdigits([vecextract(\@d,~(1<<$))])) && return 1 for 0..$#d; 0; } # _Dana Jacobsen, Nov 16 2018
    
  • Python
    from sympy import isprime
    def ok(n):
        if not isprime(n): return False
        if n < 10: return True
        s = str(n)
        si = (s[:i]+s[i+1:] for i in range(len(s)))
        return any(ok(int(t)) for t in si)
    print([k for k in range(440) if ok(k)]) # Michael S. Branicky, Jan 28 2023

A080603 Primes such that deleting some digit yields a prime.

Original entry on oeis.org

13, 17, 23, 29, 31, 37, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 229, 233, 239, 241, 263, 269, 271, 283, 293, 307, 311, 313, 317, 331, 337, 347, 353, 359, 367
Offset: 1

Views

Author

David W. Wilson, Feb 25 2003

Keywords

Comments

Leading zeros are allowed in the number that appears after the digit is deleted, as in A080608. - Michael S. Branicky, Jan 28 2023

Crossrefs

Programs

  • Mathematica
    Q@n_:=AnyTrue[FromDigits@Delete[IntegerDigits@n,#]&/@Range@IntegerLength@n, PrimeQ]; Select[Prime@Range@500, Q@# &] (* Hans Rudolf Widmer, Jun 09 2024 *)
  • Python
    from sympy import isprime
    def ok(n):
        if n < 10 or not isprime(n): return False
        s = str(n)
        si = (s[:i]+s[i+1:] for i in range(len(s)))
        return any(isprime(int(t)) for t in si)
    print([k for k in range(368) if ok(k)]) # Michael S. Branicky, Jan 28 2023

A096235 Number of n-bit base-2 deletable primes.

Original entry on oeis.org

0, 2, 2, 2, 3, 6, 6, 11, 18, 31, 49, 87, 155, 253, 427, 781, 1473, 2703, 5094, 9592, 18376, 35100, 67183, 129119, 249489, 482224, 930633, 1803598, 3502353, 6813094, 13271996, 25892906, 50583039, 98948426, 193629933, 379398057, 744508765, 1461801309
Offset: 1

Views

Author

Michael Kleber, Feb 28 2003

Keywords

Comments

A prime p is a base-b deletable prime if when written in base b it has the property that removing some digit leaves either the empty string or another deletable prime. However, in base 2 we adopt the convention that 2 = 10 and 3 = 11 are deletable.
Deleting a digit cannot leave any leading zeros in the new string. For example, deleting the 2 in 2003 to obtain 003 is not allowed.

Examples

			d base-2 d-digit deletable primes
2 2=10, 3=11
3 5=101, 7=111
4 11=1011, 13=1101
5 19=10011, 23=10111, 29=11101
6 37=100101, 43=101011, 47=101111, 53=110101, 59=111011, 61=111101
7 73=1001001, 79=1001111, 83=1010011, 101=1100101, 107=1101011, 109=1101101
		

Crossrefs

Programs

  • Mathematica
    a = {0, 2}; d = {2, 3};
    For[n = 3, n <= 15, n++,
    p = Select[Range[2^(n - 1), 2^n - 1], PrimeQ[#] &];
    ct = 0;
    For[i = 1, i <= Length[p], i++,
      c = IntegerDigits[p[[i]], 2];
      For[j = 1, j <= n, j++,
       t = Delete[c, j];
       If[t[[1]] == 0, Continue[]];
       If[MemberQ[d, FromDigits[t, 2]], AppendTo[d, p[[i]]]; ct++;
         Break[]]]];
    AppendTo[a, ct]];
    a (* Robert Price, Nov 11 2018 *)
  • Python
    from sympy import isprime
    def ok(n, prevset):
        if not isprime(n): return False
        b = bin(n)[2:]
        bi = (b[:i]+b[i+1:] for i in range(len(b)))
        return any(t[0] != '0' and int(t, 2) in prevset for t in bi)
    def afind(terms):
        s, snxt = {2, 3}, set()
        print("0,", len(s), end=", ")
        for n in range(3, terms+1):
            for i in range(2**(n-1), 2**n):
                if ok(i, s):
                    snxt.add(i)
            s, snxt = snxt, set()
            print(len(s), end=", ")
    afind(20) # Michael S. Branicky, Jan 14 2022

Extensions

a(19)-a(30) from Ryan Propper, Jul 18 2005
a(31)-a(33) from Michael S. Branicky, Jan 14 2022
a(34)-a(37) from Michael S. Branicky, May 30 2025
a(38) from Michael S. Branicky, Jun 02 2025

A321657 Base-4 deletable primes (written in base 10).

Original entry on oeis.org

2, 3, 7, 11, 13, 19, 23, 29, 31, 43, 47, 53, 59, 61, 67, 71, 79, 83, 103, 107, 109, 113, 127, 139, 151, 157, 163, 167, 173, 179, 181, 191, 197, 211, 223, 227, 229, 239, 241, 251, 263, 269, 271, 283, 307, 311, 317, 331, 359, 383, 397, 419, 431, 433, 439, 443
Offset: 1

Views

Author

Robert Price, Nov 15 2018

Keywords

Comments

A prime p is a base-b deletable prime if when written in base b it has the property that removing some digit leaves either the empty string or another deletable prime.
Deleting a digit cannot leave any leading zeros in the new string. For example, deleting the 2 in 2003 to obtain 003 is not allowed.

Crossrefs

Programs

  • Mathematica
    b = 4; d = {};
    p = Select[Range[2, 10000], PrimeQ[#] &];
    For[i = 1, i <= Length[p], i++,
      c = IntegerDigits[p[[i]], b];
      If[Length[c] == 1, AppendTo[d, p[[i]]]; Continue[]];
      For[j = 1, j <= Length[c], j++,
       t = Delete[c, j];
       If[t[[1]] == 0, Continue[]];
       If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; Break[]]]];
    d (* Robert Price, Dec 06 2018 *)

A305352 Deletable primes (A080608) under the stricter rule that leading zeros are disallowed.

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 23, 29, 31, 37, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97, 103, 107, 113, 127, 131, 137, 139, 157, 163, 167, 173, 179, 193, 197, 223, 229, 233, 239, 263, 269, 271, 283, 293, 307, 311, 313, 317, 331, 337, 347, 353, 359, 367, 373, 379, 383, 397, 431, 433, 439
Offset: 1

Views

Author

Jeppe Stig Nielsen, Aug 01 2018

Keywords

Comments

Subset of A080608. Numbers 2003, 2017, 2053, 3023, ... are in A080608 but not here.
If you start from a one-digit prime, you can try to build larger and larger deletable primes by inserting digits. If at one point you get stuck and cannot enlarge the number, you have reached a non-insertable prime (A125001). - Jeppe Stig Nielsen, Mar 28 2021

Examples

			2003 is not a member since removing a digit will either give 003 which has a leading zero, or give one of the numbers 203 or 200 which are both composite. However, 2003 is in A080608 because all of 2003, 003, 03, 3 are prime.
		

Crossrefs

Programs

  • Mathematica
    Rest@ Union@ Nest[Function[{a, p}, Append[a, With[{w = IntegerDigits[p]}, If[# == True, p, 0] &@ AnyTrue[Array[If[First@ # == 0, 1, FromDigits@ #] &@ Delete[w, #] &, Length@ w], ! FreeQ[a, #] &]]]] @@ {#, Prime[Length@ # + 1]} &, Prime@ Range@ PrimePi@ 10, 81] (* Michael De Vlieger, Aug 02 2018 *)
  • PARI
    is(n) = !ispseudoprime(n)&&return(0);my(d=digits(n));#d==1&&return(1);for(i=1,#d,my(v=vecextract(d,Str("^"i)));v[1]!=0&&is(fromdigits(v))&&return(1));0
    
  • Python
    from sympy import isprime
    def ok(n):
        if not isprime(n): return False
        if n < 10: return True
        s = str(n)
        si = (s[:i]+s[i+1:] for i in range(len(s)))
        return any(t[0] != '0' and ok(int(t)) for t in si)
    print([k for k in range(440) if ok(k)]) # Michael S. Branicky, Jan 28 2023

A319596 Base-3 deletable primes (written in base 10).

Original entry on oeis.org

2, 5, 7, 11, 17, 19, 23, 29, 47, 53, 59, 61, 71, 73, 83, 89, 101, 107, 137, 167, 173, 179, 181, 191, 197, 223, 233, 251, 263, 269, 317, 431, 461, 491, 503, 509, 521, 541, 547, 557, 569, 587, 593, 653, 659, 673, 677, 683, 701, 709, 719, 809, 911, 947, 953
Offset: 1

Views

Author

Robert Price, Nov 14 2018

Keywords

Comments

A prime p is a base-b deletable prime if when written in base b it has the property that removing some digit leaves either the empty string or another deletable prime.
Deleting a digit cannot leave any leading zeros in the new string. For example, deleting the 2 in 2003 to obtain 003 is not allowed.

Crossrefs

Programs

  • Maple
    S:= {2}: count:= 0:
    p:= 2;
    while count < 200 do
      p:= nextprime(p);
      d:= floor(log[3](p));
      for i from 0 to d do
        x:= p mod 3^(i+1);
        q:= (x mod 3^i) + (p-x)/3;
        if q >= 3^(d-1) and member(q,S) then
           S:= S union {p}; count:= count+1; break
          fi
      od;
    od:
    sort(convert(S,list)); # Robert Israel, Nov 26 2020
  • Mathematica
    b = 3; d = {};
    p = Select[Range[2, 10000], PrimeQ[#] &];
    For[i = 1, i <= Length[p], i++,
      c = IntegerDigits[p[[i]], b];
      If[Length[c] == 1, AppendTo[d, p[[i]]]; Continue[]];
      For[j = 1, j <= Length[c], j++,
       t = Delete[c, j];
       If[t[[1]] == 0, Continue[]];
       If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; Break[]]]];
    d (* Robert Price, Dec 05 2018 *)
  • Python
    from sympy import isprime
    from sympy.ntheory.digits import digits
    def ok(n, base=3):
        if not isprime(n): return False
        if n < 3: return True
        s = "".join(str(d) for d in digits(n, base)[1:])
        si = (s[:i]+s[i+1:] for i in range(len(s)))
        return any(t[0] != '0' and ok(int(t, base)) for t in si)
    print([k for k in range(954) if ok(k)]) # Michael S. Branicky, Jan 14 2022

Extensions

Removed the term 3. As pointed out by Kevin Ryde, there is no need to "seed" the list using base-2 assumptions. - Robert Price, Dec 05 2018

A322443 Base-8 deletable primes (written in base 10).

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 83, 89, 101, 107, 109, 131, 137, 139, 151, 157, 163, 167, 179, 181, 191, 197, 199, 211, 223, 229, 233, 239, 251, 269, 277, 293, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 421, 431, 443, 461, 467, 479, 491
Offset: 1

Views

Author

Robert Price, Dec 08 2018

Keywords

Comments

A prime p is a base-b deletable prime if when written in base b it has the property that removing some digit leaves either the empty string or another deletable prime.
Deleting a digit cannot leave any leading zeros in the new string. For example, deleting the 2 in 2003 to obtain 003 is not allowed.

Crossrefs

Programs

  • Mathematica
    b = 8; d = {};
    p = Select[Range[2, 10000], PrimeQ[#] &];
    For[i = 1, i <= Length[p], i++,
    c = IntegerDigits[p[[i]], b];
    If[Length[c] == 1, AppendTo[d, p[[i]]]; Continue[]];
    For[j = 1, j <= Length[c], j++,
    t = Delete[c, j];
    If[t[[1]] == 0, Continue[]];
    If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; Break[]]]];
    d (* Robert Price, Dec 08 2018 *)
  • Python
    from sympy import isprime
    def ok(n):
        if not isprime(n): return False
        if n < 8: return True
        o = oct(n)[2:]
        oi = (o[:i]+o[i+1:] for i in range(len(o)))
        return any(t[0] != '0' and ok(int(t, 8)) for t in oi)
    print([k for k in range(492) if ok(k)]) # Michael S. Branicky, Jan 13 2022

A096236 Number of n-digit base-3 deletable primes.

Original entry on oeis.org

1, 2, 4, 7, 13, 24, 38, 72, 122, 226, 400, 684, 1246, 2381, 4384, 8330, 15839, 30617, 58764, 113987, 221994, 434498, 852036, 1673320, 3296641, 6509179
Offset: 1

Views

Author

Michael Kleber, Feb 28 2003

Keywords

Comments

A prime p is a base-b deletable prime if when written in base b it has the property that removing some digit leaves either the empty string or another deletable prime. "Digit" means digit in base b.
Deleting a digit cannot leave any leading zeros in the new string. For example, deleting the 2 in 2003 to obtain 003 is not allowed.

Crossrefs

Programs

  • Mathematica
    b = 3; a = {1}; d = {2};
    For[n = 2, n <= 10, n++,
      p = Select[Range[b^(n - 1), b^n - 1], PrimeQ[#] &];
      ct = 0;
      For[i = 1, i <= Length[p], i++,
       c = IntegerDigits[p[[i]], b];
       For[j = 1, j <= n, j++,
        t = Delete[c, j];
        If[t[[1]] == 0, Continue[]];
        If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; ct++;
         Break[]]]];
      AppendTo[a, ct]];
    a (* Robert Price, Nov 12 2018 *)
  • Python
    from sympy import isprime
    from sympy.ntheory.digits import digits
    def ok(n, prevset, base=3):
        if not isprime(n): return False
        s = "".join(str(d) for d in digits(n, base)[1:])
        si = (s[:i]+s[i+1:] for i in range(len(s)))
        return any(t[0] != '0' and int(t, base) in prevset for t in si)
    def afind(terms):
        s, snxt, base = {2}, set(), 3
        print(len(s), end=", ")
        for n in range(2, terms+1):
            for i in range(base**(n-1), base**n):
                if ok(i, s):
                    snxt.add(i)
            s, snxt = snxt, set()
            print(len(s), end=", ")
    afind(13) # Michael S. Branicky, Jan 14 2022

Extensions

More terms from John W. Layman, Dec 14 2004
11 more terms from Ryan Propper, Jul 19 2005

A096243 Number of n-digit base-10 deletable primes.

Original entry on oeis.org

4, 16, 94, 585, 3788, 25768, 182762, 1340905, 10135727, 78580647, 622188500
Offset: 1

Views

Author

Michael Kleber, Feb 28 2003

Keywords

Comments

A prime p is a base-b deletable prime if when written in base b it has the property that removing some digit leaves either the empty string or another deletable prime.
Deleting a digit cannot leave any leading zeros in the new string. For example, deleting the 2 in 2003 to obtain 003 is not allowed.

Crossrefs

Programs

  • Mathematica
    b = 10; a = {4}; d = {2, 3, 5, 7};
    For[n = 2, n <= 5, n++,
      p = Select[Range[b^(n - 1), b^n - 1], PrimeQ[#] &];
      ct = 0;
      For[i = 1, i <= Length[p], i++,
       c = IntegerDigits[p[[i]], b];
       For[j = 1, j <= n, j++,
        t = Delete[c, j];
        If[t[[1]] == 0, Continue[]];
        If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; ct++;
         Break[]]]];
      AppendTo[a, ct]];
    a (* Robert Price, Nov 13 2018 *)
  • Python
    from sympy import isprime
    def ok(n, prevset):
        if not isprime(n): return False
        s = str(n)
        si = (s[:i]+s[i+1:] for i in range(len(s)))
        return any(t[0] != '0' and int(t) in prevset for t in si)
    def afind(terms):
        s, snxt = {2, 3, 5, 7}, set()
        print(len(s), end=", ")
        for n in range(2, terms+1):
            for i in range(10**(n-1), 10**n):
                if ok(i, s):
                    snxt.add(i)
            s, snxt = snxt, set()
            print(len(s), end=", ")
    afind(6) # Michael S. Branicky, Jan 14 2022

Extensions

a(6)-a(9) from Ryan Propper, Jul 19 2005
a(10) from Michael S. Branicky, Jan 14 2022
a(11) from Michael S. Branicky, Jul 06 2023

A321700 Base-5 deletable primes (written in base 10).

Original entry on oeis.org

2, 3, 7, 11, 13, 17, 19, 23, 37, 47, 53, 59, 61, 67, 71, 73, 79, 89, 97, 103, 107, 113, 137, 197, 227, 239, 263, 269, 271, 307, 311, 317, 337, 347, 353, 359, 367, 373, 379, 389, 397, 439, 449, 479, 487, 503, 523, 547, 557, 563, 569, 571, 607, 613, 677, 727, 739, 887, 947, 977
Offset: 1

Views

Author

Robert Price, Nov 17 2018

Keywords

Comments

A prime p is a base-b deletable prime if when written in base b it has the property that removing some digit leaves either the empty string or another deletable prime.
Deleting a digit cannot leave any leading zeros in the new string. For example, deleting the 2 in 2003 to obtain 003 is not allowed.

Crossrefs

Programs

  • Mathematica
    b = 5; d = {};
    p = Select[Range[2, 10000], PrimeQ[#] &];
    For[i = 1, i <= Length[p], i++,
      c = IntegerDigits[p[[i]], b];
      If[Length[c] == 1, AppendTo[d, p[[i]]]; Continue[]];
      For[j = 1, j <= Length[c], j++,
       t = Delete[c, j];
       If[t[[1]] == 0, Continue[]];
       If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; Break[]]]];
    d (* Robert Price, Dec 06 2018 *)
Showing 1-10 of 36 results. Next