import java.util.*;
import java.util.stream.Collectors;

public final class Util {
    private Util() {}

    public static Set<Integer> primes(int n) {

        BitSet bitSet = new BitSet(n + 1);
        bitSet.set(2, n + 1);

        for (int i = bitSet.nextSetBit(2); i != -1 ; i = bitSet.nextSetBit(i + 1)) {
            for (int j = i * 2; j <= n; j += i) {
                bitSet.clear(j);
            }
        }

        return bitSet.stream()
                .boxed()
                .collect(Collectors.toCollection(() -> new HashSet<>(n)));
    }
}

@@ -147,16 +147,207 @@
 t n) %7B%0A%0A
+        return primesBits(n).stream()%0A                .boxed()%0A                .collect(Collectors.toCollection(() -%3E new HashSet%3C%3E(n)));%0A    %7D%0A%0A    public static BitSet primesBits(int n) %7B%0A%0A
         
@@ -600,25 +600,24 @@
 %7D%0A        %7D%0A
-%0A
         retu
@@ -629,116 +629,8 @@
 tSet
-.stream()%0A                .boxed()%0A                .collect(Collectors.toCollection(() -%3E new HashSet%3C%3E(n)))
 ;%0A  

add bitset version of Util#primes