ArrayList sieve(int n){ ArrayList al=new ArrayList<>(); boolean prime[] = new boolean[n+1]; for(int i=0;i