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

A069246 Primes which yield a prime whenever a 1 is inserted anywhere in them (including at the beginning or end).

Original entry on oeis.org

3, 7, 13, 31, 103, 109, 151, 181, 193, 367, 571, 601, 613, 811, 1117, 1831, 4519, 6871, 11119, 11317, 11467, 13171, 16141, 17167, 18211, 18457, 27241, 38917, 55381, 71317, 81199, 81931, 86743, 114031, 139861, 141667, 151687, 179203, 200191
Offset: 1

Views

Author

N. J. A. Sloane, Apr 14 2002

Keywords

Crossrefs

Prime subsequence of A068679.

Programs

  • Magma
    [p: p in PrimesUpTo(210000) | forall{m: t in [0..#Intseq(p)] | IsPrime(m) where m is (Floor(p/10^t)*10+1)*10^t+p mod 10^t}]; // Bruno Berselli, Sep 03 2012
  • Mathematica
    d[n_]:=IntegerDigits[n]; ins[n_]:=FromDigits/@Table[Insert[d[n],1,k],{k,Length[d[n]]+1}]; Select[Prime[Range[20000]],And@@PrimeQ/@ins[#] &] (* Jayanta Basu, May 20 2013 *)

Extensions

More terms from Vladeta Jovovic, Apr 16 2002

A215421 Primes that remain prime when a single digit 9 is inserted between any two consecutive digits or as the leading or trailing digit.

Original entry on oeis.org

7, 19, 37, 41, 199, 239, 311, 587, 661, 941, 967, 1009, 1997, 4993, 4999, 5393, 5651, 6911, 9109, 9397, 9679, 9829, 19417, 20233, 22549, 27397, 29389, 31387, 39989, 71419, 71569, 90599, 91951, 95369, 97103, 98909, 99023, 160009, 225919, 267389, 313991, 328849
Offset: 1

Views

Author

Paolo P. Lava, Aug 10 2012

Keywords

Examples

			31387 is prime and also 313879, 313897, 313987, 319387, 391387, 931387.
		

Crossrefs

Programs

  • Maple
    A215421:=proc(q,x)
    local a,b,c,d,i,n,ok;
    for n from 1 to q do
      a:=ithprime(n); b:=0; while a>0 do b:=b+1; a:=trunc(a/10); od;
      a:=ithprime(n); ok:=1;
      for i from 0 to b do
        c:=a+9*10^i*trunc(a/10^i)+10^i*x; if not isprime(c) then ok:=0; break; fi;
      od;
      if ok=1 then print(ithprime(n)); fi;
    od; end:
    A215421(1000,9);
  • Mathematica
    Select[Prime[Range[30000]],AllTrue[FromDigits/@Table[Insert[ IntegerDigits[ #],9,n],{n, IntegerLength[ #]+1}],PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Oct 22 2016 *)

A215419 Primes that remain prime when a single digit 3 is inserted between any two consecutive digits or as the leading or trailing digit.

Original entry on oeis.org

7, 11, 17, 31, 37, 73, 271, 331, 359, 373, 673, 733, 1033, 2297, 3119, 3461, 3923, 5323, 5381, 5419, 6073, 6353, 9103, 9887, 18289, 23549, 25349, 31333, 32933, 33349, 35747, 37339, 37361, 37489, 47533, 84299, 92333, 93241, 95093, 98491, 133733, 136333, 139333
Offset: 1

Views

Author

Paolo P. Lava, Aug 10 2012

Keywords

Examples

			18289 is prime and also 182893, 182839, 182389, 183289, 138289, 318289.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local L,d,k,M;
    if not isprime(n) then return false fi;
    L:= convert(n,base,10);
    d:= nops(L);
    for k from 0 to d do
       M:= [seq(L[i],i=1..k),3,seq(L[i],i=k+1..d)];
       if not isprime(add(M[i]*10^(i-1),i=1..d+1)) then return false fi;
    od;
    true
    end proc;
    select(filter, [seq(i,i=3..2*10^5,2)]); # Robert Israel, Oct 09 2017
  • Mathematica
    ins@n_:=Insert[IntegerDigits@n,3,#]&/@Range@(IntegerLength@n+1);
    Cases[{#,FromDigits@#&/@ins@#}&/@ Cases[Range[11,70000],?PrimeQ], {,{?PrimeQ..}}][[All,1]] (* _Hans Rudolf Widmer, Dec 21 2023 *)

A164329 Numbers which yield a prime whenever a zero is inserted between any two digits.

Original entry on oeis.org

11, 13, 17, 19, 37, 41, 49, 53, 59, 61, 67, 71, 79, 89, 97, 109, 113, 119, 121, 131, 133, 149, 161, 169, 191, 197, 203, 227, 239, 253, 269, 281, 283, 299, 301, 319, 323, 337, 367, 379, 383, 401, 403, 407, 421, 449, 457, 473, 493, 499, 503, 509, 511, 539, 551
Offset: 1

Views

Author

Farideh Firoozbakht, Sep 22 2009

Keywords

Comments

Single-digit numbers 0, ..., 9 seem to be excluded but would satisfy the condition voidly. - M. F. Hasler, May 10 2018

Examples

			998471 is in the sequence because all the five numbers 9098471, 9908471, 9980471, 9984071 and 9984701 are primes.
		

Crossrefs

Cf. A216169 (subset of composite terms), A215417 (subset of primes), A159236 (0 is inserted between all digits).
Cf. A068679 (1 is prefixed, appended or inserted anywhere), A069246 (primes among these), A068673 (1 is prefixed, or appended).
Cf. A158594 (3 is prefixed, appended or inserted anywhere), A215419 (primes among these).
Cf. A069832 (7 is prefixed, appended or inserted anywhere), A215420 (primes among these), A068677 (7 is prefixed or appended).
Cf. A069833 (9 is prefixed, appended or inserted anywhere), A215421 (primes among these).
Cf. A158232 (13 is prefixed or appended).

Programs

  • Mathematica
    f[n_]:=(r=IntegerDigits[n];l=Length[r];For[k=2,PrimeQ[FromDigits[Insert
    [r,0,k]]],k++ ];If[k==l+1,n,0]);Select[Range[11,560],f[ # ]>0&]
  • PARI
    is(n, L=logint(n+!n, 10)+1, P)={!for(k=1, L-1, isprime([10*P=10^(L-k),1]*divrem(n, P))||return) && n>9} \\ M. F. Hasler, May 10 2018

Extensions

Erroneous comment and cross-references deleted by M. F. Hasler, May 10 2018

A216169 Composite numbers > 9 which yield a prime whenever a 0 is inserted between any two digits.

Original entry on oeis.org

49, 119, 121, 133, 161, 169, 203, 253, 299, 301, 319, 323, 403, 407, 473, 493, 511, 539, 551, 581, 611, 667, 679, 713, 869, 901, 913, 943, 1007, 1067, 1079, 1099, 1211, 1273, 1691, 1729, 1799, 1909, 2021, 2047, 2101, 2117, 2359, 2407, 2533, 2717, 2759, 2899
Offset: 1

Views

Author

Paolo P. Lava, Sep 03 2012

Keywords

Examples

			2359 is not prime but 23509, 23059 and 20359 are all primes.
		

Crossrefs

Subset of composite numbers in A164329. - M. F. Hasler, May 10 2018

Programs

  • Maple
    A216169:=proc(q,x)
    local a,b,c,i,n,ok;
    for n from 10 to q do
    if not isprime(n) then
      a:=n; b:=0; while a>0 do b:=b+1; a:=trunc(a/10); od; a:=n; ok:=1;
      for i from 1 to b-1 do c:=a+9*10^i*trunc(a/10^i)+10^i*x;
        if not isprime(c) then ok:=0; break; fi; od;
      if ok=1 then print(n); fi;
    fi; od; end: A216169(1000,0);
  • Mathematica
    Select[Range[10,3000],CompositeQ[#]&&AllTrue[Table[FromDigits[ Insert[ IntegerDigits[ #],0,n]],{n,2,IntegerLength[#]}],PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Mar 13 2018 *)
  • PARI
    is(n, L=logint(n+!n, 10)+1, P)={!isprime(n) && !for(k=1, L-1, isprime([10*P=10^(L-k),1]*divrem(n, P))||return) && n>9} \\ M. F. Hasler, May 10 2018

Extensions

Name edited by M. F. Hasler, May 10 2018

A215420 Primes that remain prime when a single digit 7 is inserted between any two consecutive digits or as the leading or trailing digit.

Original entry on oeis.org

3, 19, 97, 433, 487, 541, 691, 757, 853, 1471, 2617, 2953, 4507, 6481, 7351, 7417, 8317, 13177, 31957, 42457, 46477, 47977, 50077, 59053, 71917, 73897, 74377, 77479, 77743, 77761, 79039, 99103, 175687, 220897, 271177, 360973
Offset: 1

Views

Author

Paolo P. Lava, Aug 10 2012

Keywords

Examples

			59053 is prime as are 590537, 590573, 590753, 597053, 579053, and 759053.
		

Crossrefs

Programs

  • Maple
    A215420:=proc(q,x)
    local a,b,c,d,i,n,ok;
    for n from 1 to q do
      a:=ithprime(n); b:=0; while a>0 do b:=b+1; a:=trunc(a/10); od;
      a:=ithprime(n); ok:=1;
      for i from 0 to b do
        c:=a+9*10^i*trunc(a/10^i)+10^i*x; if not isprime(c) then ok:=0; break; fi;
      od;
      if ok=1 then print(ithprime(n)); fi;
    od; end:
    A215420(1000,7);
  • Mathematica
    Select[Prime[Range[31000]],AllTrue[FromDigits/@Table[Insert[ IntegerDigits[ #],7,n],{n,IntegerLength[#]+1}],PrimeQ]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Oct 29 2020 *)

A069833 Prefixing, suffixing or inserting a 9 in the number anywhere gives a prime.

Original entry on oeis.org

7, 19, 37, 41, 91, 199, 209, 239, 311, 539, 587, 661, 749, 923, 931, 941, 967, 1009, 1079, 1139, 1997, 2717, 2959, 3971, 3979, 4559, 4993, 4999, 5393, 5629, 5651, 6401, 6739, 6911, 8213, 8491, 8939, 9109, 9397, 9607, 9679, 9829, 11089, 11227, 13943
Offset: 1

Views

Author

Amarnath Murthy, Apr 14 2002

Keywords

Crossrefs

Cf. A215421 (subsequence of primes).
Cf. A068679 (1 is prefixed, appended or inserted anywhere), A069246 (primes among these), A068673 (1 is prefixed, or appended).
Cf. A158594 (3 is prefixed, appended or inserted anywhere), A215419 (primes among these).
Cf. A069832 (7 is prefixed, appended or inserted anywhere), A215420 (primes among these), A068677 (7 is prefixed or appended).
Cf. A158232 (13 is prefixed or appended).
Cf. A164329 (0 is inserted), A216169 (subset of composite terms), A215417 (subset of primes), A159236 (0 is inserted between all digits).

Programs

  • PARI
    is(n,L=logint(n+!n,10)+1,d,P)={!for(k=0,L,isprime((d=divrem(n,P=10^(L-k)))[2]+(10*d[1]+9)*P)||return)} \\ M. F. Hasler, May 10 2018

Extensions

More terms from Vladeta Jovovic, Apr 16 2002
Corrected offset by Chai Wah Wu, Oct 10 2019

A217044 Primes that remain prime when a single "2" digit is inserted between any two adjacent decimal digits.

Original entry on oeis.org

17, 23, 29, 41, 53, 83, 89, 101, 113, 131, 137, 149, 251, 359, 401, 419, 443, 461, 647, 719, 797, 821, 863, 941, 1289, 1823, 2111, 2543, 3323, 3413, 4013, 4463, 4751, 5021, 5501, 5807, 6299, 6827, 7229, 7643, 7883, 8039, 8219, 8609, 8837, 9221, 9227, 9461, 9623
Offset: 1

Views

Author

Paolo P. Lava, Sep 25 2012

Keywords

Examples

			9461 is prime and also 94621, 94261, 92461.
		

Crossrefs

Programs

  • Magma
    [p: p in PrimesInInterval(11, 10000) | forall{m: t in [1..#Intseq(p)-1] | IsPrime(m) where m is (Floor(p/10^t)*10+2)*10^t+p mod 10^t}]; // Bruno Berselli, Sep 26 2012
    
  • Maple
    with(numtheory);
    A217044:=proc(q,x)
    local a,b,c,i,n,ok;
    for n from 5 to q do
    a:=ithprime(n); b:=0;
    while a>0 do b:=b+1; a:=trunc(a/10); od; a:=ithprime(n); ok:=1;
      for i from 1 to b-1 do
        c:=a+9*10^i*trunc(a/10^i)+10^i*x;
        if not isprime(c) then ok:=0; break; fi; od;
      if ok=1 then print(ithprime(n)); fi;
    od; end:
    A217044(100000,2)
  • Mathematica
    Select[Prime[Range[5,1200]],And@@PrimeQ[FromDigits/@Table[ Insert[ IntegerDigits[ #],2,i],{i,2,IntegerLength[#]}]]&] (* Harvey P. Dale, Oct 09 2012 *)
  • PARI
    is(n)=my(v=concat([""], digits(n))); for(i=2, #v-1, v[1]=Str(v[1], v[i]); v[i]=2; if(i>2, v[i-1]=""); if(!isprime(eval(concat(v))), return(0))); isprime(n)  \\ Charles R Greathouse IV, Sep 26 2012

A217047 Primes that remain prime when a single "8" digit is inserted between any two adjacent digits.

Original entry on oeis.org

11, 23, 47, 83, 131, 173, 179, 233, 353, 389, 521, 569, 641, 683, 839, 887, 911, 971, 983, 1229, 1289, 1913, 2087, 2663, 2837, 2879, 3329, 3671, 3677, 3803, 3821, 4259, 4409, 4817, 4871, 4889, 5237, 5477, 5693, 6449, 6581, 6863, 7283, 7487, 7583, 7823, 7853
Offset: 1

Views

Author

Paolo P. Lava, Sep 25 2012

Keywords

Comments

These numbers are either isolated primes or the smaller of a pair of twin primes. - Davide Rotondo, Mar 11 2025

Examples

			325421 is prime and also 3254281, 3254821, 3258421, 3285421 and 3825421.
		

Crossrefs

Programs

  • Magma
    [p: p in PrimesInInterval(11,8000) | forall{m: t in [1..#Intseq(p)-1] | IsPrime(m) where m is (Floor(p/10^t)*10+8)*10^t+p mod 10^t}]; // Bruno Berselli, Sep 26 2012
    
  • Maple
    A217044:=proc(q,x) local a,b,c,d,i,k,n,ok,v; v:=[]; a:=10;
    for n from 1 to q do a:=nextprime(a); d:=length(a); ok:=1;
    for k from 1 to d-1 do b:=a mod 10^k; c:=trunc(a/10^k); i:=x*10^k+b; i:=c*10^length(i)+i;
    if not isprime(i) then ok:=0; break; fi; od; if ok=1 then v:=[op(v),a]; fi; od; op(v); end:
    A217044(10^3,8);
  • PARI
    is(n)=my(v=concat([""],digits(n)));for(i=2,#v-1,v[1]=Str(v[1], v[i]); v[i]=8;if(i>2,v[i-1]="");if(!isprime(eval(concat(v))), return(0)));isprime(n) \\ Charles R Greathouse IV, Sep 25 2012
    
  • Python
    from sympy import isprime, primerange
    def ok(p):
        if p < 10: return False
        s = str(p)
        return all(isprime(int(s[:i] + "8" + s[i:])) for i in range(1, len(s)))
    def aupto(limit): return [p for p in primerange(1, limit+1) if ok(p)]
    print(aupto(7854)) # Michael S. Branicky, Nov 23 2021

A217062 Primes that remain prime when a single "9" digit is inserted between any two adjacent digits.

Original entry on oeis.org

11, 13, 17, 19, 23, 37, 41, 53, 59, 61, 97, 101, 107, 113, 149, 193, 197, 199, 227, 239, 263, 269, 271, 311, 331, 367, 409, 431, 443, 457, 499, 587, 617, 659, 661, 691, 727, 733, 751, 823, 863, 941, 967, 1009, 1423, 1571, 1709, 1759, 1973, 1993, 1997, 2063, 2137
Offset: 1

Views

Author

Paolo P. Lava, Sep 26 2012

Keywords

Examples

			214883 is prime and also 2148893, 2148983, 2149883, 2194883 and 2914883.
		

Crossrefs

Programs

  • Maple
    with(numtheory);
    A217062:=proc(q,x)
    local a,b,c,i,n,ok;
    for n from 5 to q do
      a:=ithprime(n); b:=0; while a>0 do b:=b+1; a:=trunc(a/10); od; a:=ithprime(n); ok:=1;
        for i from 1 to b-1 do
          c:=a+9*10^i*trunc(a/10^i)+10^i*x;  if not isprime(c) then ok:=0; break; fi; od;
        if ok=1 then print(ithprime(n)); fi; od; end:
    A217062(1000000,9);
  • PARI
    is(n)=my(v=concat([""], digits(n))); for(i=2, #v-1, v[1]=Str(v[1], v[i]); v[i]=9; if(i>2, v[i-1]=""); if(!isprime(eval(concat(v))), return(0))); isprime(n) \\ Charles R Greathouse IV, Sep 26 2012
Showing 1-10 of 29 results. Next