Code:
import java.util.ArrayList;
public class PP {
public static void main(String[] nt){
// To avoid repetion of Primorial primes ArrayList<Integer>integers=new ArrayList<>();
//This is end Value int x=11;
for(int J=2;J<=x;J++) {
int pn = 1;
//Calculating Primorial for (int i = 2; i <= J; i++) {
if (isprime(i)) {
pn = pn * i;
}
}
//Checking For Prime if(isprime(pn-1)){
if(!integers.contains(pn-1)){
integers.add(pn-1);
}
}if(isprime(pn+1)){
if(!integers.contains(pn+1)){
integers.add(pn+1);
}
}
}
//Printing all Primorial Primes for (int a:integers){
System.out.println(a);
}
}
static boolean isprime(int n){
for (int i=2;i<=n/2;i++){
if(n%i==0){
return false;
}
}
return true;
}
}
Output: