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

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

A081027 Primes that are not in A080608.

Original entry on oeis.org

11, 19, 41, 61, 89, 101, 109, 149, 151, 181, 191, 199, 211, 227, 241, 251, 257, 277, 281, 349, 389, 401, 409, 419, 421, 449, 461, 491, 499, 521, 541, 557, 577, 587, 601, 619, 641, 661, 691, 727, 757, 787, 809, 811, 821, 827, 857, 877, 881, 887, 911, 919, 941
Offset: 1

Views

Author

David W. Wilson, Mar 02 2003

Keywords

Comments

Repeated removal of a single digit must eventually result in a nonprime.
Undeletable primes. - Arkadiusz Wesolowski, Oct 18 2011

Crossrefs

Cf. A080608.

Programs

  • Python
    from sympy import isprime, prevprime
    def c(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 c(int(t)) for t in si)
    def ok(n):
        return isprime(n) and not c(n)
    print([k for k in range(942) if ok(k)]) # Michael S. Branicky, Jan 27 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

A096246 Base-2 deletable primes (written in base 10).

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 19, 23, 29, 37, 43, 47, 53, 59, 61, 73, 79, 83, 101, 107, 109, 137, 149, 151, 157, 163, 167, 173, 179, 197, 211, 229, 277, 281, 293, 307, 311, 313, 317, 331, 347, 349, 359, 389, 397, 419, 421, 457, 461, 467, 557, 563, 569, 587, 599, 601, 613
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.

Crossrefs

Programs

  • Maple
    isDel := proc(n::integer) local b2,redu,rpr,d; if n = 2 or n =3 then RETURN(true); elif not isprime(n) then RETURN(false); else b2 := convert(n,base,2); for d from 1 to nops(b2) do redu := [op(1..d-1,b2),op(d+1..nops(b2),b2) ]; if op(nops(redu),redu) = 1 then rpr := sum( op(i,redu)*2^(i-1),i=1..nops(redu)); if isDel(rpr) then RETURN(true); fi; fi; od; RETURN(false); fi; end: for n from 1 to 200 do if isDel(ithprime(n)) then printf("%d,",ithprime(n)); fi; od: # R. J. Mathar, Apr 25 2006
  • Mathematica
    a = {}; c = {1}; While[Length[a] < 100, b = c; c = {}; lb = Length[b]; Do[nb = b[[ib]]; cdb = RealDigits[nb, 2]; db = cdb[[1]]; ldb = cdb[[2]]; Do[dc = Insert[db, 0, j]; nc = FromDigits[dc, 2]; If[PrimeQ[nc], AppendTo[c, nc]], {j, 2, ldb + 1}]; Do[dc = Insert[db, 1, j]; nc = FromDigits[dc, 2]; If[PrimeQ[nc], AppendTo[c, nc]], {j, 2, ldb + 1}], {ib, 1, lb}]; c = Union[{}, c]; a = Union[a, c]]; a (* Lei Zhou, Mar 06 2015 *)
    a = {0, 2}; d = {2, 3};
    For[n = 3, n <= 15, n++,
      p = Select[Range[2^(n - 1), 2^n - 1], PrimeQ[#] &];
      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]]];  Break[]]]]];
    d (* Robert Price, Nov 11 2018 *)
  • Python
    from sympy import isprime
    def ok(n):
        if not isprime(n): return False
        if n == 2 or n == 3: return True
        b = bin(n)[2:]
        bi = (b[:i]+b[i+1:] for i in range(len(b)))
        return any(t[0] != '0' and ok(int(t, 2)) for t in bi)
    print([k for k in range(614) if ok(k)]) # Michael S. Branicky, Jan 13 2022

Extensions

More terms from R. J. Mathar, Apr 25 2006

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

A137812 Left- or right-truncatable primes.

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, 113, 131, 137, 139, 167, 173, 179, 197, 223, 229, 233, 239, 271, 283, 293, 311, 313, 317, 331, 337, 347, 353, 359, 367, 373, 379, 383, 397, 431, 433, 439, 443, 467, 479, 523, 547, 571
Offset: 1

Views

Author

T. D. Noe, Feb 11 2008

Keywords

Comments

Repeatedly removing a digit from either the left or right produces only primes. There are 149677 terms in this sequence, ending with 8939662423123592347173339993799.
The number of n-digit terms is A298048(n). - Jon E. Schoenfield, Jan 28 2022

Examples

			139 is here because (removing 9 from the right) 13 is prime and (removing 1 from the left) 3 is prime.
		

Crossrefs

Cf. A024770 (right-truncatable primes), A024785 (left-truncatable primes), A077390 (left-and-right truncatable primes), A080608.
Cf. A298048 (number of n-digit terms).

Programs

  • Mathematica
    Clear[s]; s[0]={2,3,5,7}; n=1; While[s[n]={}; Do[k=s[n-1][[i]]; Do[p=j*10^n+k; If[PrimeQ[p], AppendTo[s[n],p]], {j,9}]; Do[p=10*k+j; If[PrimeQ[p], AppendTo[s[n],p]], {j,9}], {i,Length[s[n-1]]}]; s[n]=Union[s[n]]; Length[s[n]]>0, n++ ];t=s[0]; Do[t=Join[t,s[i]], {i,n}]; t
  • Python
    from sympy import isprime
    def agen():
        primes = [2, 3, 5, 7]
        while len(primes) > 0:
            yield from primes
            cands = set(int(d+str(p)) for p in primes for d in "123456789")
            cands |= set(int(str(p)+d) for p in primes for d in "1379")
            primes = sorted(c for c in cands if isprime(c))
    afull = [an for an in agen()]
    print(afull[:60]) # Michael S. Branicky, Aug 04 2022

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 *)

A179336 Primes containing at least one prime digit in base 10.

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, 151, 157, 163, 167, 173, 179, 193, 197, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 11 2010

Keywords

Comments

a(n) = A080608(n) for n<28; A080608 is a subsequence;
A179335(n) < 10 iff prime(n) is in this sequence;
A109066(n) > 0 iff prime(n) is in this sequence. [Corrected by M. F. Hasler, Aug 27 2012]

Crossrefs

Intersection of A118950 and A000040; relative complement A000040 \ A034844.

Programs

  • Haskell
    a179336 n = a179336_list !! (n-1)
    a179336_list = filter (any (`elem` "2357") . show ) a000040_list
    -- Reinhard Zumkeller, Jul 19 2011

Formula

a(n) ~ n log n. - Charles R Greathouse IV, Nov 01 2022

A188809 Rigidly-deletable primes under the rule that leading zeros are disallowed.

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 29, 31, 43, 47, 59, 67, 71, 79, 83, 97, 103, 107, 127, 157, 163, 269, 271, 359, 383, 439, 457, 463, 487, 509, 547, 569, 571, 607, 643, 659, 683, 701, 709, 751, 769, 863, 907, 929, 983, 1087, 1217, 1303, 1427, 1487, 2069, 2371, 2609, 2671
Offset: 1

Views

Author

Arkadiusz Wesolowski, Apr 11 2011

Keywords

Comments

Rigidly-deletable primes are deletable primes where the choice of digit to delete is unique (all other choices give nonprime numbers).

Examples

			103 is a member since removing a digit will either give 03 which has a leading zero, or give one of the numbers 13 or 10. 2017 is not a member since removing a digit will either give 017 which has a leading zero, or give one of the numbers 217, 207, or 201, which are all composite. - _Arkadiusz Wesolowski_, Nov 27 2021
		

Crossrefs

Cf. A080608 (deletable primes).

Programs

  • Mathematica
    lst1 = {}; Do[If[PrimeQ[n], p = n; Label[begin]; lst2 = {}; Do[i = IntegerDigits[p]; c = FromDigits@Drop[i, {d}]; If[Length[i] - 1 == IntegerLength[c], AppendTo[lst2, c]], {d, IntegerLength@p}]; t = Select[lst2, PrimeQ[#] &]; If[Length[t] == 1, p = FromDigits[t]; Goto[begin]]; If[IntegerLength[p] == 1, AppendTo[lst1, n]]], {n, 2671}]; lst1 (* Arkadiusz Wesolowski, Feb 22 2013 *)

Extensions

Name clarified by Arkadiusz Wesolowski, Nov 27 2021

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
Showing 1-10 of 43 results. Next