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.

Previous Showing 11-20 of 27 results. Next

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

Original entry on oeis.org

13, 19, 67, 73, 97, 277, 367, 379, 421, 433, 487, 541, 691, 757, 853, 967, 1117, 1471, 1747, 2017, 2617, 2749, 2851, 2953, 3463, 3529, 3571, 4507, 5077, 5923, 6073, 6079, 6343, 6481, 6577, 6709, 6829, 6967, 7351, 7417, 7573, 7681, 8317, 8719, 9157, 9649, 13177
Offset: 1

Views

Author

Paolo P. Lava, Sep 26 2012

Keywords

Examples

			311683 is prime and also 3116873, 3116783, 3117683, 3171683 and 3711683.
		

Crossrefs

Programs

  • Maple
    with(numtheory);
    A217065:=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:
    A217065(1000000,7);
  • Mathematica
    Select[Prime[Range[5,1600]],AllTrue[FromDigits/@Table[Insert[ IntegerDigits[ #],7,i],{i,2,IntegerLength[#]}],PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Oct 12 2016 *)
  • PARI
    is(n)=my(v=concat([""], digits(n))); for(i=2, #v-1, v[1]=Str(v[1], v[i]); v[i]=7; if(i>2, v[i-1]=""); if(!isprime(eval(concat(v))), return(0))); isprime(n) \\ Charles R Greathouse IV, Sep 26 2012

A304244 Numbers that yield a prime when prime(k) is inserted after the k-th digit, for any k >= 1, k < number of digits.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 23, 27, 29, 41, 51, 53, 77, 81, 83, 87, 89, 99, 101, 149, 191, 239, 251, 287, 317, 353, 359, 419, 473, 497, 509, 527, 533, 611, 677, 743, 797, 809, 821, 887, 893, 941, 983, 1037, 1043, 1277, 1421, 1841, 1853, 1973, 1979, 2543
Offset: 1

Views

Author

M. F. Hasler, May 21 2018

Keywords

Comments

The primes to insert are: 2 (after the first digit), 3 (after the second digit, if there are at least three), etc.
Inspired by A304243 and analog sequences given in cross-references.
The sequence is finite: if insertion of 3 after the second digit yields a prime, then the sum of digits must be congruent to 1 or 2 (mod 3). However, insertion of 2 after the first digit also must yield a prime, so only the second case is possible. But then, insertion of a digit 7 cannot yield a prime, so no term can have 5 digits or more. (Sequence A304243 circumvents this restriction by excluding 3 from the primes to insert, but it is still finite for a similar reason occurring later.)

Examples

			The 1-digit numbers 0..9 are included since the condition is voidly satisfied: Nothing can be inserted, therefore each of the resulting numbers is prime.
17 is in the sequence because 127 is prime.
101 is in the sequence because 1201 and 1031 are prime.
		

Crossrefs

Cf. A304243 (2 is prefixed or prime(k+2) is inserted after the k-th digit).
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).
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,P)={!for(k=1,L-1, isprime((d=divrem(n,P=10^(L-k)))[2]+(10^logint(10*p=prime(k),10)*d[1]+p)*P)|| return)}

A216165 Composite numbers and 1 which yield a prime whenever a 1 is inserted anywhere in them, including at the beginning or end.

Original entry on oeis.org

1, 49, 63, 81, 91, 99, 117, 123, 213, 231, 279, 319, 427, 459, 621, 697, 721, 801, 951, 987, 1113, 1131, 1261, 1821, 1939, 2101, 2149, 2211, 2517, 2611, 3151, 3219, 4011, 4411, 4887, 5031, 5361, 6231, 6487, 7011, 7209, 8671, 9141, 9801, 10051, 10161, 10281
Offset: 1

Views

Author

Paolo P. Lava, Sep 03 2012

Keywords

Examples

			7209 is not prime but 72091, 72019, 72109, 71209 and 17209 are all primes.
		

Crossrefs

Programs

  • Magma
    [n: n in [1..11000] | not IsPrime(n) and forall{m: t in [0..#Intseq(n)] | IsPrime(m) where m is (Floor(n/10^t)*10+1)*10^t+n mod 10^t}]; // Bruno Berselli, Sep 03 2012
  • Maple
    with(numtheory);
    A216165:=proc(q,x)
    local a,b,c,i,n,ok;
    for n from 1 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 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(n); fi;
    fi;
    od; end:
    A216165(1000,1);
  • Mathematica
    Join[{1},Select[Range[11000],CompositeQ[#]&&AllTrue[FromDigits/@ Table[ Insert[ IntegerDigits[#],1,i],{i,IntegerLength[#]+1}],PrimeQ]&]] (* Harvey P. Dale, Mar 24 2017 *) (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Mar 24 2017 *)

A304243 Numbers that yield a prime when prime(k+2) is inserted after the k-th digit (or prime(1) = 2 before the 1st digit for k=0), for 0 <= k <= number of digits.

Original entry on oeis.org

27, 33, 39, 57, 93, 333, 3747, 5073, 5997, 7239, 10053, 22419, 349731, 425991, 714807, 1719279, 81453303, 406253439, 481683189, 886662423, 2653294371
Offset: 1

Views

Author

M. F. Hasler, May 10 2018

Keywords

Comments

The primes to insert are 2 (in front) or 5, 7, 11, 13, ... after the number's first, second, third, ... digit. So there cannot be any 1 digit solution because if 5 is appended this cannot yield a prime. One can show that the terms cannot have more than 21 digits.
The prime 3 is excluded from the strings to insert, because else no term could have more than 2 digits: to be prime with 2 prefixed or with 3 inserted, the number must be congruent to 2 (mod 3), so it cannot be prime with 7 appended or inserted. See also the Rivera link and A304244.

Examples

			a(1) = 27 because 2|27 = 227, 2|5|7 = 257 and 27|7 = 277 are all prime.
Similarly for a(6) = 333, because 2333, 3533, 3373 and 33311 are all prime.
		

Crossrefs

Cf. A304244 (prime(k) is inserted after the k-th digit), A304245 (2 is inserted after the first digit, or prime(k+1) is inserted after the k-th digit for k > 1).
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).
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,P)={isprime(n+2*10^L) && !for(k=1,L, isprime((d=divrem(n,P=10^(L-k)))[2]+(10^logint(10*p=prime(2+k),10)*d[1]+p)*P)|| return)}

A304245 Numbers that yield a prime when '2' is inserted between the first and second digit, or prime(k+1) is inserted after the k-th digit for any k > 1, k < number of digits.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 23, 27, 29, 41, 51, 53, 77, 81, 83, 87, 89, 99, 101, 113, 129, 149, 159, 179, 191, 203, 213, 221, 237, 251, 267, 269, 273, 281, 287, 293, 297, 321, 329, 357, 359, 401, 417, 419, 429, 441, 461, 471, 497, 509, 531, 561, 581, 603, 611, 663, 669, 687, 699, 707, 711
Offset: 1

Views

Author

M. F. Hasler, May 21 2018

Keywords

Comments

The primes to be inserted are: 2 between 1st and 2nd digit, or 5 between 2nd and 3rd digit, or 7 between 3rd and 4th digit, etc.
The prime 3 is excluded because it would restrict the terms to have no more than 4 digits; see A304244 and the Rivera link in A304243.
The two terms 27 and 87 are the only numbers (with more than one digit) for which 2, 5 or 7 can be inserted between any two digits to yield a prime: all of 227, 257, 277, 827, 857 an 877 are prime. There is no other such number with more than 2 digits.

Examples

			The 1-digit numbers 0..9 are included since the condition is voidly satisfied: nothing can be inserted, therefore each of the resulting numbers is prime.
17 is in the sequence because 127 is prime.
101 is in the sequence because 1201 and 1051 are prime.
		

Crossrefs

Cf. A304243 (2 is prefixed or prime(k+2) is inserted after the k-th digit), A304244 (prime(k) is inserted after the k-th digit) .
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).
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,P)={!for(k=1,L-1, isprime((d=divrem(n,P=10^(L-k)))[2]+(10^logint(10*p=prime(k+(k>1)),10)*d[1]+p)*P)|| return)}

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

Original entry on oeis.org

19, 37, 43, 61, 67, 73, 97, 109, 199, 211, 223, 241, 349, 409, 421, 457, 463, 541, 571, 751, 757, 823, 991, 1033, 1087, 1321, 1423, 1447, 1543, 2749, 3361, 3469, 3499, 3847, 4111, 4273, 4483, 5059, 5437, 5443, 5449, 6373, 6709, 6793, 7687, 8089, 8221, 8443
Offset: 1

Views

Author

Paolo P. Lava, Sep 25 2012

Keywords

Examples

			87697 is prime and also 876947, 876497, 874697 and 847697.
		

Crossrefs

Programs

  • Maple
    with(numtheory);
    A217045:=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:
    A217045(100000,4)
  • Mathematica
    Select[Prime[Range[5,1500]],AllTrue[Table[FromDigits[Insert[ IntegerDigits[ #],4,n]],{n,2,IntegerLength[#]}],PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Dec 04 2017 *)
  • PARI
    is(n)=my(v=concat([""], digits(n))); for(i=2, #v-1, v[1]=Str(v[1], v[i]); v[i]=4; if(i>2, v[i-1]=""); if(!isprime(eval(concat(v))), return(0))); isprime(n) \\ Charles R Greathouse IV, Sep 26 2012

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

Original entry on oeis.org

13, 17, 23, 29, 37, 41, 43, 47, 53, 59, 61, 71, 79, 83, 97, 101, 109, 113, 137, 157, 163, 167, 263, 277, 293, 307, 313, 317, 331, 397, 421, 443, 457, 463, 569, 607, 653, 659, 661, 673, 691, 739, 769, 787, 809, 823, 829, 863, 881, 977, 997, 1063, 1087, 1453
Offset: 1

Views

Author

Paolo P. Lava, Sep 25 2012

Keywords

Examples

			185917 is prime and also 1859167, 1859617, 1856917, 1865917 and 1685917.
		

Crossrefs

Programs

  • 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,6)
  • Mathematica
    Select[Prime[Range[5,1200]],And@@PrimeQ[FromDigits/@Table[ Insert[ IntegerDigits[ #],6,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]=6; if(i>2, v[i-1]=""); if(!isprime(eval(concat(v))), return(0))); isprime(n) \\ Charles R Greathouse IV, Sep 26 2012

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

Original entry on oeis.org

11, 17, 19, 23, 29, 31, 37, 41, 43, 61, 73, 79, 89, 97, 101, 103, 127, 167, 173, 181, 211, 233, 239, 251, 271, 283, 307, 331, 359, 373, 439, 491, 509, 523, 547, 599, 673, 709, 733, 769, 877, 887, 937, 941, 991, 1033, 1229, 1381, 1619, 1721, 1759, 1789, 1901
Offset: 1

Views

Author

Paolo P. Lava, Sep 26 2012

Keywords

Examples

			212881 is prime and also 2128831, 2128381, 2123881, 213288 and 2312881.
		

Crossrefs

Programs

  • Magma
    [p: p in PrimesInInterval(11, 2000) | forall{m: t in [1..#Intseq(p)-1] | IsPrime(m) where m is (Floor(p/10^t)*10+3)*10^t+p mod 10^t}]; // Bruno Berselli, Sep 26 2012
    
  • Maple
    with(numtheory);
    A217063:=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:
    A217063(1000000,3);
  • PARI
    is(n)=my(v=concat([""], digits(n))); for(i=2, #v-1, v[1]=Str(v[1], v[i]); v[i]=3; if(i>2, v[i-1]=""); if(!isprime(eval(concat(v))), return(0))); isprime(n) \\ Charles R Greathouse IV, Sep 26 2012
    
  • Python
    from sympy import isprime, primerange
    def ok(p):
        if p < 10: return False
        s = str(p)
        return all(isprime(int(s[:i] + "3" + 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(1901)) # Michael S. Branicky, Nov 17 2021

A216166 Composite numbers and 1 which yield a prime whenever a 3 is inserted anywhere in them (including at the beginning or end).

Original entry on oeis.org

1, 121, 343, 361, 533, 637, 793, 889, 943, 1183, 3013, 3223, 3353, 3403, 3757, 3827, 3893, 4313, 4543, 4963, 8653, 10423, 14257, 20339, 23083, 23419, 30917, 33031, 33101, 33323, 33433, 33701, 33821, 34333, 34393, 35453, 36437, 36533, 39137, 39247, 42869, 43337
Offset: 1

Views

Author

Paolo P. Lava, Sep 03 2012

Keywords

Examples

			3827 is not prime but 38273, 38237, 38327 and 33827 are all primes.
		

Crossrefs

Programs

  • Magma
    [n: n in [1..50000] | not IsPrime(n) and forall{m: t in [0..#Intseq(n)] | IsPrime(m) where m is (Floor(n/10^t)*10+3)*10^t+n mod 10^t}]; // Bruno Berselli, Sep 03 2012
  • Maple
    with(numtheory);
    A216166:=proc(q,x)
    local a,b,c,i,n,ok;
    for n from 1 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 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(n); fi;
    fi;
    od; end:
    A216166(1000,3);
  • Mathematica
    ap3Q[n_]:=CompositeQ[n]&&AllTrue[FromDigits/@Table[Insert[ IntegerDigits[ n],3,k],{k,IntegerLength[n]+1}],PrimeQ]; Join[{1},Select[Range[ 44000], ap3Q]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Mar 25 2020 *)

A216167 Composite numbers which yield a prime whenever a 5 is inserted anywhere in them, excluding at the end.

Original entry on oeis.org

9, 21, 57, 63, 69, 77, 87, 93, 153, 231, 381, 407, 413, 417, 501, 531, 581, 651, 669, 741, 749, 783, 791, 987, 1241, 1551, 1797, 1971, 2189, 2981, 3381, 3419, 3591, 3951, 4083, 4503, 4833, 4949, 4959, 5049, 5117, 5201, 5229, 5243, 5529, 5547, 5603, 5691, 5697
Offset: 1

Views

Author

Paolo P. Lava, Sep 03 2012

Keywords

Examples

			4083 is not prime but 40853, 40583, 45083 and 54083 are all primes.
		

Crossrefs

Programs

  • Magma
    [n: n in [1..6000] | not IsPrime(n) and forall{m: t in [1..#Intseq(n)] | IsPrime(m) where m is (Floor(n/10^t)*10+5)*10^t+n mod 10^t}]; // Bruno Berselli, Sep 03 2012
    
  • Maple
    with(numtheory);
    A216167:=proc(q,x)
    local a,b,c,i,n,ok;
    for n from 1 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 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:
    A216167(1000,5);
  • Mathematica
    Select[Range[6000],CompositeQ[#]&&AllTrue[FromDigits/@Table[Insert[IntegerDigits[#],5,p],{p,IntegerLength[#]}],PrimeQ]&] (* Harvey P. Dale, Oct 02 2022 *)
  • Python
    from sympy import isprime
    def ok(n):
        if n < 2 or n%10 not in {1, 3, 7, 9} or isprime(n): return False
        s = str(n)
        return all(isprime(int(s[:i] + '5' + s[i:])) for i in range(len(s)))
    print(list(filter(ok, range(5698)))) # Michael S. Branicky, Sep 21 2021
Previous Showing 11-20 of 27 results. Next