/* This program finds the smallest integer greater than a given number such that it is a super prime */ public class superprime{ /* function to check whether a given number i is super prime or not */ public static boolean check_super(int i) { int temp; boolean flag=true; temp = i; while(temp>0) { flag = check_prime(temp); temp = temp/10; if(flag==false) break; } return flag; } /* Funtion to check whether a given number x is prime or not */ public static boolean check_prime(int x) { int k,j; boolean flag=true; if(x==1) return false; else if(x==2) return true; for(j=2;j<=x-1;j++) { k=x%j; if(k==0) {flag=false;break;} } return flag; } public static void main(String args[]) { int k; boolean flag=false; k = Integer.parseInt(args[0]); if(k>=1) { while(flag==false) { flag=check_super(k); if(flag==true) System.out.println("The smallest super prime greater than the given number "+k); k++; } } else { System.out.println("Invalid option"); } } }