Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5. public static boolean simple(int x){
  6. for(int i = 2; i <= Math.sqrt(x); ++i){
  7. if(x % i == 0){
  8. return false;
  9. }
  10. }
  11.  
  12. return true;
  13. }
  14.  
  15. public static void main(String[] args) {
  16. Scanner in = new Scanner(System.in);
  17. int a = in.nextInt();
  18.  
  19. while(true){
  20. a++;
  21. if(simple(a)){
  22. System.out.println(a);
  23. return;
  24. }
  25. }
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement