private long cribaEratostenes(long n)
    {
        ArrayList<Long> primos = new ArrayList<Long>();
        long tope = (long)Math.sqrt(n) + 1;
        int pos = 0;
        for(long i=2; i <= tope; i++){
            if(!primos.contains(Long.valueOf(i))){
                for(long j=i; j <= n/i+1; j++)
                    primos.add(Long.valueOf(i*j));
            }
        }
        
        long c = 0;
        long ultimo = 1;
        for(pos = 2; pos < n; pos++){
            if(!primos.contains(Long.valueOf(pos))){
                System.out.println(++c + ": " + pos);
                ultimo = pos;
            }
        }
        return ultimo;
    }