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

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

Original entry on oeis.org

1, 3, 7, 13, 31, 49, 63, 81, 91, 99, 103, 109, 117, 123, 151, 181, 193, 213, 231, 279, 319, 367, 427, 459, 571, 601, 613, 621, 697, 721, 801, 811, 951, 987, 1113, 1117, 1131, 1261, 1821, 1831, 1939, 2101, 2149, 2211, 2517, 2611, 3151, 3219, 4011, 4411, 4519, 4887, 5031, 5361, 6231, 6487, 6871, 7011, 7209, 8671, 9141, 9801, 10051
Offset: 1

Views

Author

Amarnath Murthy, Mar 02 2002

Keywords

Comments

If R(p) = (10^p-1)/9 is a prime then (10^(p-1)-1)/9 belongs to this sequence.

Examples

			123 belongs to this sequence as the numbers 1123, 1213, 1231 obtained by inserting a 1 in all possible ways are all primes.
		

Crossrefs

Programs

  • Mathematica
    d[n_]:=IntegerDigits[n]; ins[n_]:=FromDigits/@Table[Insert[d[n],1,k],{k,Length[d[n]]+1}]; Select[Range[10060],And@@PrimeQ/@ins[#] &] (* Jayanta Basu, May 20 2013 *)
    Select[Range[11000],AllTrue[FromDigits/@Table[Insert[ IntegerDigits[ #],1,n],{n,IntegerLength[#]+1}],PrimeQ]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 16 2020 *)
  • Python
    from sympy import isprime
    A068679_list, n = [], 1
    while len(A068679_list) < 1000:
        if isprime(10*n+1):
            s = str(n)
            for i in range(len(s)):
                if not isprime(int(s[:i]+'1'+s[i:])):
                    break
            else:
                A068679_list.append(n)
        n += 1 # Chai Wah Wu, Oct 02 2019

Extensions

More terms from Eli McGowan (ejmcgowa(AT)mail.lakeheadu.ca), Apr 11 2002
More terms from Vladeta Jovovic, Apr 16 2002

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

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

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

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