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 11 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

A068677 Numbers that yield a prime when a 7 is prefixed or suffixed to them.

Original entry on oeis.org

1, 3, 9, 19, 27, 33, 39, 57, 61, 87, 97, 109, 121, 127, 129, 159, 177, 187, 213, 229, 237, 243, 247, 283, 321, 351, 369, 417, 433, 451, 459, 481, 487, 507, 523, 529, 541, 547, 573, 589, 603, 621, 639, 673, 691, 699, 717, 723, 741, 753, 757, 793, 823, 829, 853
Offset: 1

Views

Author

Amarnath Murthy, Mar 02 2002

Keywords

Examples

			129 belongs to this sequence as both 1297 and 7129 are primes.
		

Crossrefs

Programs

  • Maple
    filter:= n -> isprime(10*n+7) and isprime(7*10^(1+ilog10(n))+n):
    select(filter, [seq(i,i=1..1000,2)]); # Robert Israel, Jul 01 2025
  • Mathematica
    Flatten@Position[{# +7*10^IntegerLength@#,7+10*#}&/@Range@10000,{?PrimeQ ..}] (* _Hans Rudolf Widmer, Aug 22 2024 *)

Extensions

More terms from Sascha Kurz, Mar 17 2002

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

A158594 Numbers which yield a prime whenever a 3 is prefixed, appended or inserted.

Original entry on oeis.org

1, 7, 11, 17, 31, 37, 73, 121, 271, 331, 343, 359, 361, 373, 533, 637, 673, 733, 793, 889, 943, 1033, 1183, 2297, 3013, 3119, 3223, 3353, 3403, 3461, 3757, 3827, 3893, 3923, 4313, 4543, 4963, 5323, 5381, 5419, 6073, 6353, 8653, 9103, 9887, 10423, 14257
Offset: 1

Views

Author

Ulrich Krug (leuchtfeuer37(AT)gmx.de), Mar 22 2009

Keywords

Comments

1) It is conjectured that sequences of this type are infinite; also that an infinite number of primes is included.
2) Necessarily a(n) has end digit 1,3,7 or 9.
3) Sum of digits of a(n) has form 3k-1 or 3k+1.
4) Sequence is part of A068674 a(n) n=1,...,30: first 14 primes: 7, 11, 17, 31, 37, 73, 271, 331, 359, 373, 673, 733, 2297, 3461.
5) Note the "world record" 2297: smallest prime which yields five other primes 32297, 23297, 22397, 22937, 22973.

Examples

			109 is not a term: 3109, 1039, 1093 are primes, but 1309 = 7 * 11 * 17.
121 is a term: 3121 (3 prefixed), 1213 (3 appended), 1321 and 1231 (3 inserted) are primes.
		

References

  • Marcus Du Sautoy, The Music of the Primes: Searching to Solve the Greatest Mystery in Mathematics, HarperCollins. 2004
  • Bryan Bunch, Kingdom of Infinite Number: A Field Guide, W.H. Freeman & Company, 2001

Crossrefs

Cf. A068674, Numbers which yield primes when a 3 is prefixed or appended.
Cf. A068679, Numbers which yield a prime whenever a 1 is inserted anywhere in them (including at the beginning or end).
Cf. A158232, Numbers which yield primes when "13" is prefixed or appended.

Programs

  • Maple
    Lton := proc(L) local i ; add(op(i,L)*10^(i-1),i=1..nops(L) ) ; end: isA158594 := proc(n) local dgs,i,p; dgs := convert(n,base,10) ; p := [3,op(dgs)] ; if not isprime(Lton(p)) then RETURN(false) ; fi; p := [op(dgs),3] ; if not isprime(Lton(p)) then RETURN(false) ; fi; for i from 1 to nops(dgs)-1 do p := [op(1..i,dgs),3,op(i+1..nops(dgs),dgs)] ; if not isprime(Lton(p)) then RETURN(false) ; fi; od: RETURN(true) ; end: for n from 1 to 25000 do if isA158594(n) then printf("%d,",n) ; fi; od: # R. J. Mathar, Mar 26 2009
  • PARI
    isok(n)={i=#digits(n);m=1;k=0;while(kJinyuan Wang, Feb 02 2019

Extensions

Corrected and extended by Chris K. Caldwell and R. J. Mathar, Mar 26 2009

A069832 Prefixing, suffixing or inserting a 7 in the number anywhere gives a prime.

Original entry on oeis.org

1, 3, 9, 19, 27, 33, 39, 57, 87, 97, 159, 177, 187, 433, 487, 541, 603, 691, 717, 753, 757, 853, 949, 1257, 1471, 1707, 2277, 2367, 2617, 2953, 4317, 4507, 4623, 4779, 4797, 5773, 6481, 6757, 6777, 7017, 7351, 7417, 7471, 7479, 7747, 7797, 7813, 7977
Offset: 1

Views

Author

Amarnath Murthy, Apr 14 2002

Keywords

Crossrefs

Programs

  • Mathematica
    psi7Q[n_]:=Module[{idn=IntegerDigits[n]},And@@PrimeQ[FromDigits/@ Table[ Insert[ idn,7,i],{i,Length[idn]+1}]]]; Select[Range[8000],psi7Q] (* Harvey P. Dale, Sep 18 2012 *)

Extensions

More terms from Vladeta Jovovic, Apr 16 2002
Offset changed to 1 by Giovanni Resta, Oct 14 2019

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

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

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

Original entry on oeis.org

1, 9, 27, 33, 39, 57, 87, 159, 177, 187, 603, 717, 753, 949, 1257, 1707, 2277, 2367, 4317, 4623, 4779, 4797, 5773, 6757, 6777, 7017, 7471, 7479, 7747, 7797, 7813, 7977, 8797, 9777, 9987, 10777, 11757, 17679, 28269, 28437, 29779, 34177, 34771, 40059, 41721
Offset: 1

Views

Author

Paolo P. Lava, Sep 03 2012

Keywords

Examples

			4623 is not prime but 46237, 46273, 46723, 47623 and 74623 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+7)*10^t+n mod 10^t}]; // Bruno Berselli, Sep 03 2012
  • Maple
    with(numtheory);
    A216168:=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:
    A216168(1000,7);

A304248 Numbers that yield a prime whenever a '3' is inserted between any two digits.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 17, 19, 23, 29, 31, 37, 41, 43, 49, 61, 73, 79, 89, 97, 101, 103, 121, 127, 167, 173, 181, 209, 211, 233, 239, 247, 251, 271, 283, 299, 307, 331, 343, 359, 361, 373, 391, 437, 439, 473, 491, 497, 509, 523, 533, 547, 551, 599
Offset: 1

Views

Author

M. F. Hasler, Jun 01 2018

Keywords

Comments

Motivated by existing sequences defined in a similar way for other digits (e.g., A164329 for digit 0), subsequence A158594 = intersection of this and A068674 ('3' is prefixed or appended), and others: cf. cross-references.

Examples

			121 is in the sequence because it yields a prime when a digit 3 is inserted after the first or after the second digit, which yields the prime 1321 or 1231, respectively. The term itself does not need to be prime.
The single-digit numbers 0..9 are in the sequence because they satisfy the condition voidly: nothing can be inserted, so no insertion yields a nonprime, so all possible insertions always yield a prime.
		

Crossrefs

Cf. A164329 (prime when 0 is inserted anywhere), A216169 (subset of composite terms), A215417 (subset of primes), A159236 (prime when 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), A304246 (1 is inserted anywhere).
Cf. A304247 (2 is inserted anywhere).
Cf. A158594 (3 is prefixed, appended or inserted anywhere), A215419 (primes among these), A068674 (3 is prefixed or appended).
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. 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), A304245 (prime(k+1) is inserted after the k-th digit, k > 1, or '2' after the first digit).

Programs

  • Magma
    [0] cat [k:k in [1..600]| forall{i:i in [1..#Intseq(k)-1]| IsPrime(Seqint(Reverse(v[1..i] cat [3] cat v[i+1..#v]))) where v is Reverse(Intseq(k))}]; // Marius A. Burtea, Feb 09 2020
  • Mathematica
    Select[Range[0,600],AllTrue[FromDigits/@Table[Insert[IntegerDigits[#],3,n],{n,2,IntegerLength[ #]}],PrimeQ]&] (* Harvey P. Dale, Nov 06 2022 *)
  • PARI
    is(n, p=3, L=logint(n+!n, 10)+1, d, P)=!for(k=1, L-1, isprime((d=divrem(n, P=10^(L-k)))[2]+(10*d[1]+p)*P)||return)
    
Showing 1-10 of 11 results. Next