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.

A354440 Digitally delicate primes where the number of digits appended on the left needed to get a prime increases.

This page as a plain text file.
%I A354440 #62 Dec 21 2022 21:25:33
%S A354440 294001,604171,971767,2690201,10564877,104097043,354975121,1378229029,
%T A354440 1444623667,1594371379,3979115747,15737262803,22090236251,28198307351,
%U A354440 35373071549,49430022721,67580736437,142243533671,659956292591,1385321944133
%N A354440 Digitally delicate primes where the number of digits appended on the left needed to get a prime increases.
%C A354440 Digitally delicate primes (A050249) are primes such that if any single digit is changed the new number is composite. This sequence gives the smallest such prime that needs more digits added to the left to get to another prime. While this list is not complete it has been shown to be finite.  A widely digitally delicate prime is known which never becomes prime regardless of the number of extra digits.
%C A354440          294001 can add 1
%C A354440          604171 can add 3
%C A354440          971767 can add 4
%C A354440         2690201 can add 5
%C A354440        10564877 can add 6
%C A354440       104097043 can add 7
%C A354440       354975121 can add 10
%C A354440      1378229029 can add 11
%C A354440      1444623667 can add 12
%C A354440      1594371379 can add 14
%C A354440      3979115747 can add 15
%C A354440     15737262803 can add 16
%C A354440     22090236251 can add 20
%C A354440     28198307351 can add 26
%C A354440     35373071549 can add 27
%C A354440     49430022721 can add 28
%C A354440     67580736437 can add 30
%C A354440    142243533671 can add 47
%C A354440    659956292591 can add 59
%C A354440   1385321944133 can add 76
%D A354440 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
%e A354440 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.
%e A354440 Starting at 604171 you could add 3 extra digits to the left but not 4 without being able to produce a prime number.
%e A354440 X604171 is not prime
%e A354440 X0604171 is not prime
%e A354440 X00604171 is not prime
%e A354440 however 4000604171 is a prime number
%e A354440 For the largest one found so far
%e A354440 X1385321944133
%e A354440 X01385321944133
%e A354440 X001385321944133
%e A354440 ...
%e A354440 X000000000000000000000000000000000000000000000000000000000000000000000000001385321944133 are all composite
%e A354440 but 900000000000000000000000000000000000000000000000000000000000000000000000000001385321944133 is prime
%o A354440 (Java)
%o A354440 import java.math.BigInteger;
%o A354440 public class delicateprimes {
%o A354440 public static void main(String[] args) {
%o A354440   BigInteger i,reci=new BigInteger("0");
%o A354440   i= new BigInteger("1");
%o A354440   long count=0, v,rec=-1;
%o A354440   for(long loop=1;;loop++)
%o A354440   {
%o A354440     i=i.nextProbablePrime();
%o A354440     v = delicate(i,true);
%o A354440     if(v>rec) {count++; rec=v;reci=i;System.out.println("REC=("+reci+", "+rec+") " +loop +"   "+count);}
%o A354440     if(loop%100000==0)System.out.println("Still running, last prime seen was "+i);
%o A354440   }
%o A354440 }
%o A354440 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
%o A354440 {
%o A354440   int e, length,max=200;
%o A354440   if(!f)max=1;
%o A354440   String num="", num2="";
%o A354440   if(!prime(a))return -1;
%o A354440   for(e=0;e<max;e++)   //While widely digitally delicate primes do exist, this needs to have a stop point
%o A354440   {
%o A354440     num=zeros(e)+a.toString();
%o A354440     if(e>0)length=e;else length = num.length();
%o A354440     for(int j=0;j<length;j++)
%o A354440     {
%o A354440       for(int k=0;k<=9;k++)
%o A354440       {
%o A354440         num2=num.substring(0,j)+k+num.substring(j+1);
%o A354440         if(num2.contentEquals(num))continue;
%o A354440         if(prime(new BigInteger(num2))) {return e-1;}
%o A354440       }
%o A354440     }
%o A354440   }
%o A354440   return e-1;
%o A354440 }
%o A354440 static boolean prime(BigInteger a)
%o A354440 {
%o A354440   return a.isProbablePrime(100);
%o A354440 }
%o A354440 static String zeros(int n)
%o A354440 {
%o A354440   StringBuffer temp=new StringBuffer("");
%o A354440   for(int i=0;i<n;i++)temp=temp.append("0");
%o A354440   return temp.toString();
%o A354440 }
%o A354440 }
%Y A354440 Cf. A050249 (digitally delicate primes).
%K A354440 nonn,base,more
%O A354440 1,1
%A A354440 _Jason Rodgers_, May 29 2022
%E A354440 Partially edited by _N. J. A. Sloane_, Sep 03 2022