Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static boolean simple(int x){
- for(int i = 2; i <= Math.sqrt(x); ++i){
- if(x % i == 0){
- return false;
- }
- }
- return true;
- }
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int a = in.nextInt();
- while(true){
- a++;
- if(simple(a)){
- System.out.println(a);
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement