Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.math.*;
- public class PrimeSubstrings
- {
- public static void main(String[] args)
- {
- String[] primes={"2","3","5","7","11","13","17","19","23","29","31"};
- for (long i=113171923295L; true; i++)
- {
- String s=""+i;
- if (!(new BigInteger(s)).isProbablePrime(20)) continue;
- boolean ok=true;
- for (String a : primes)
- if (s.indexOf(a)<0)
- {
- ok=false;
- break;
- }
- if (ok)
- {
- System.out.println("answer is "+i);
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement