A371475
Smallest weak prime in base 2n+1.
Original entry on oeis.org
2, 83, 223, 2789, 3347, 4751, 484439, 10513, 10909, 2823167, 68543, 181141, 6139219, 488651, 356479, 399946711, 22549349, 8371249, 660040873, 12088631, 3352003, 234606268969, 84343813, 82751411, 153722088497, 141451831, 11085190183, 350552595007, 535946951, 658716229
Offset: 1
-
from sympy import isprime, nextprime
from sympy.ntheory import digits
def A371475(n):
if n == 1: return 2
p, r = 5, (n<<1)+1
while True:
s = digits(p,r)[1:]
l = len(s)
for i,j in enumerate(s[::-1]):
m = r**i
for k in range(j&1,r,2):
if k!=j and isprime(p+(k-j)*m):
break
else:
continue
break
else:
return p
p = nextprime(p)
A185188
Twin primes which are weakly prime numbers.
Original entry on oeis.org
64067207819, 64067207821, 86132413439, 86132413441, 343051899689, 343051899691, 841323181889, 841323181891, 889872452759, 889872452761, 908010864419, 908010864421, 973782583469, 973782583471
Offset: 1
A186694
Numbers ending in 1, 3, 7 or 9 such that changing any one decimal digit produces a composite number.
Original entry on oeis.org
212159, 294001, 505447, 584141, 595631, 604171, 872897, 971767, 1062599, 1203623, 1282529, 1293671, 1524181, 1566691, 1702357, 1830661, 2017963, 2474431, 2690201, 3085553, 3326489, 3716213, 3964169, 4103917, 4134953, 4173921, 4310617, 4376703
Offset: 1
- Arkadiusz Wesolowski, Table of n, a(n) for n = 1..1500
- Chris Caldwell, The Prime Glossary, Weakly prime
- G. L. Honaker, Jr. and Chris Caldwell, Prime Curios! 212159
- G. L. Honaker, Jr. and Chris Caldwell, Prime Curios! 17171...58369 (1000-digits)
- Terence Tao, A remark on primality testing and decimal expansions, Journal of the Australian Mathematical Society 91:3 (2011), pp. 405-413.
-
primeProof[n_] := Module[{d, e, isPP, num}, d=IntegerDigits[n]; isPP=True; Do[e=d; e[[i]]=j; num=FromDigits[e]; If[num != n && PrimeQ[num], isPP=False; Break[]], {i, Length[d]}, {j, 0, 9}]; isPP]; Select[Range[1, 1000000, 2], Mod[#, 5] > 0 && primeProof[#] &] (* T. D. Noe, Feb 26 2011 *)
A199428
Extreme weakly prime numbers.
Original entry on oeis.org
40144044691, 58058453543, 89797181359, 185113489357, 213022025663, 222498988079, 365115312521, 397195264507, 507086259359, 537598896647, 576872778883, 671770400281, 710587610861, 719174481061, 815380174991, 840202011349, 855194972407, 869287849361, 891600776149
Offset: 1
A226241
Primes that cannot be reached from 2 via a chain of primes obtained adding or deleting a digit from the end or the beginning of the previous term of the chain.
Original entry on oeis.org
89, 101, 103, 107, 109, 151, 163, 227, 251, 257, 263, 269, 281, 307, 389, 401, 409, 457, 503, 509, 521, 557, 563, 569, 587, 601, 607, 701, 709, 809, 821, 827, 857, 863, 881, 887, 907, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069
Offset: 1
All the primes < 89 can be reached from 2. For example, 2 -> 23 -> 3 -> 37.
-
step[p_] := Block[{dn = 10^IntegerLength@p}, Select[ Union[{Floor[p/10], Mod[p, dn/10]}, p*10 + {1, 3, 7, 9}, Range[9]*dn + p], PrimeQ[#] &]]; old = {}; new = {2}; wrk = {}; While[new != {}, wrk = Flatten[step /@ new]; old = Union[new, old]; new = Complement[wrk, old]; Print["# = ", Length@old, " max = ", Max[old], " new # = ", Length@new]]; Print["Missing up to 1000 = ", Complement[Prime@Range[168], old]]
A353737
Length of longest n-digit optimal prime ladder (base 10).
Original entry on oeis.org
2, 4, 7, 9, 11, 13, 15
Offset: 1
The 1-digit optimal prime ladder 3 - 5 is tied for the longest amongst 1-digit primes, so a(1) = 2.
The 2-digit optimal prime ladder 97 - 17 - 13 - 53 is tied for the longest amongst 2-digit primes, so a(2) = 4.
The 3-digit optimal prime ladder 389 - 383 - 283 - 281 - 251 - 751 - 761 is tied for the longest amongst 3-digit primes, so a(3) = 7.
The 4-digit optimal prime ladder 4651 - 4951 - 4931 - 4933 - 4733 - 6733 - 6833 - 6883 - 6983 is tied for the longest amongst 4-digit primes, so a(4) = 9.
The 5-digit optimal prime ladder 88259 - 48259 - 45259 - 45959 - 41959 - 41969 - 91969 - 91961 - 99961 - 99761 - 99721 is tied for the longest amongst 5-digit primes, so a(5) = 13.
The 6-digit optimal prime ladder 440497 - 410497 - 410491 - 710491 - 710441 - 710443 - 717443 - 917443 - 917843 - 907843 - 905843 - 905833 - 995833 is tied for the longest amongst 6-digit primes, so a(6) = 13.
The 7-digit optimal prime ladder 3038459 - 3032459 - 3032453 - 3034453 - 3034457 - 3034657 - 3074657 - 3074557 - 4074557 - 4079557 - 4779557 - 4779547 - 7779547 - 7759547 - 7755547 is tied for the longest amongst 7-digit primes, so a(7) = 15. - _Michael S. Branicky_, May 21 2022
A158641
Strong primes p: adding 2 to any one digit of p produces a prime number (no digits 8 & 9 in p).
Original entry on oeis.org
3, 5, 11, 17, 41, 107, 137, 347, 2111, 2657, 3527, 4421, 6761, 21011, 24371, 32057
Offset: 1
2111 is in this sequence because all 2111, 4111, 2311, 2131 and 2113 are prime numbers.
32057 is in this sequence because all 32057, 52057, 34057, 32257, 32077 and 32059 are prime numbers.
Cf.
A050249,
A158124,
A158125 Weakly prime numbers (changing any one digit always produces a composite number).
-
Lton := proc(L) local i; add(op(i,L)*10^(i-1),i=1..nops(L)) ; end: isA158641 := proc(p) local pdgs,pplus,i ; if isprime(p) then pdgs := convert(p,base,10) ; if convert(pdgs,set) intersect {8,9} <> {} then false; else for i from 1 to nops(pdgs) do pplus := subsop(i=2+op(i,pdgs),pdgs) ; if not isprime(Lton(pplus)) then RETURN(false); fi; od: true; fi; else false; fi; end: for n from 1 do p := ithprime(n) ; if isA158641(p) then print(p) ; fi; od: # R. J. Mathar, Apr 16 2009
-
spQ[p_]:=Max[IntegerDigits[p]]<8&&AllTrue[FromDigits/@Table[MapAt[ 2+#&,IntegerDigits[ p],n],{n,IntegerLength[p]}],PrimeQ]; Select[Prime[ Range[ 3500]],spQ] (* Harvey P. Dale, Nov 26 2022 *)
-
test(p)=my(v=eval(Vec(Str(p)))); for(i=1,#v, if(v[i]>7,return(0))); for(i=0,#v-1, if(!isprime(p+2*10^i), return(0))); 1
forprime(p=2,4e9, if(isprime(p+2) && test(p), print1(p","))) \\ Charles R Greathouse IV, Sep 09 2009
-
has(n)=if(vecmax(Set(digits(n)))>7, return(0)); for(i=0,#digits(n)-1, if(!isprime(n+2*10^i), return(0))); 1
select(has, primes(3438)) \\ Charles R Greathouse IV, Mar 11 2016
A343075
Digitally delicate square numbers (changing any one decimal digit always produces a nonsquare).
Original entry on oeis.org
25, 121, 144, 169, 196, 256, 289, 324, 1024, 1089, 1156, 1296, 1369, 1444, 1521, 1681, 1764, 1849, 1936, 2500, 3136, 3249, 3364, 3481, 3721, 3844, 3969, 4096, 4356, 4489, 4624, 4761, 5041, 5184, 6084, 6241, 6561, 6724, 6889, 7056, 7396
Offset: 1
n = 25, changing the digit 2 in 25 to d5, d from {0,1,3,4,5,6,7,8,9} gives no square, changing the digit 5 in 25 to 2d, d from {0,1,2,3,4,6,7,8,9} gives no square. Thus n = 25 is a member of the sequence.
-
changes[n_] := Module[{d = IntegerDigits[n]}, FromDigits @ ReplacePart[d, First[#] -> Last[#]] & /@ Tuples[{Range[Length[d]], Range[0, 9]}]]; q[n_] := AllTrue[changes[n], # == n || ! IntegerQ @ Sqrt[#] &]; Select[Range[100]^2, q] (* Amiram Eldar, Apr 04 2021 *)
-
from sympy import integer_nthroot
def is_square(n): return integer_nthroot(n, 2)[1]
def change1(n):
s = str(n)
for i in range(len(s)):
for d in set("0123456789") - {s[i]}:
yield int(s[:i] + d + s[i+1:])
def ok(sqr): return not any(is_square(t) for t in change1(sqr))
print(list(filter(ok, (k*k for k in range(87))))) # Michael S. Branicky, Apr 04 2021
A354440
Digitally delicate primes where the number of digits appended on the left needed to get a prime increases.
Original entry on oeis.org
294001, 604171, 971767, 2690201, 10564877, 104097043, 354975121, 1378229029, 1444623667, 1594371379, 3979115747, 15737262803, 22090236251, 28198307351, 35373071549, 49430022721, 67580736437, 142243533671, 659956292591, 1385321944133
Offset: 1
You can add any 1 extra digit on the left to 294001 without getting a prime but adding two digits would allow for the creation of a prime. For example 10294001 is prime but none of X294001 are.
Starting at 604171 you could add 3 extra digits to the left but not 4 without being able to produce a prime number.
X604171 is not prime
X0604171 is not prime
X00604171 is not prime
however 4000604171 is a prime number
For the largest one found so far
X1385321944133
X01385321944133
X001385321944133
...
X000000000000000000000000000000000000000000000000000000000000000000000000001385321944133 are all composite
but 900000000000000000000000000000000000000000000000000000000000000000000000000001385321944133 is prime
- Michael Filaseta and Jeremiah Southwick, Primes that become composite after changing an arbitrary digit, Math. Comp. (2021) Vol. 90, 979-993. doi:10.1090/mcom/3593
Cf.
A050249 (digitally delicate primes).
-
import java.math.BigInteger;
public class delicateprimes {
public static void main(String[] args) {
BigInteger i,reci=new BigInteger("0");
i= new BigInteger("1");
long count=0, v,rec=-1;
for(long loop=1;;loop++)
{
i=i.nextProbablePrime();
v = delicate(i,true);
if(v>rec) {count++; rec=v;reci=i;System.out.println("REC=("+reci+", "+rec+") " +loop +" "+count);}
if(loop%100000==0)System.out.println("Still running, last prime seen was "+i);
}
}
static int delicate(BigInteger a,boolean f) // Returns how many digits can be tacked on the delicate prime. f=false just tests the prime with no extra 0s
{
int e, length,max=200;
if(!f)max=1;
String num="", num2="";
if(!prime(a))return -1;
for(e=0;e0)length=e;else length = num.length();
for(int j=0;j
Comments