SHARE
TWEET

Untitled

a guest Sep 23rd, 2019 425 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.math.*;
  2. public class PrimeSubstrings
  3. {
  4.     public static void main(String[] args)
  5.     {
  6.         String[] primes={"2","3","5","7","11","13","17","19","23","29","31"};
  7.         for (long i=113171923295L; true; i++)
  8.         {
  9.             String s=""+i;
  10.             if (!(new BigInteger(s)).isProbablePrime(20)) continue;
  11.  
  12.             boolean ok=true;
  13.             for (String a : primes)
  14.                 if (s.indexOf(a)<0)
  15.                 {
  16.                     ok=false;
  17.                     break;
  18.                 }
  19.  
  20.             if (ok)
  21.             {
  22.                 System.out.println("answer is "+i);
  23.                 break;
  24.             }
  25.         }
  26.     }
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top