public static void main(String[] args) {
        int limit = 1000000;
        TreeSet<Integer> primes = primeSieve(limit);
        int stash = 0;
        int currentCount = 0;

        for (int s : primes) {
            int start = 0;
            int count = 0;

            for (int p : primes) {
                if (s <= p) {
                    start += p;
                    count++;

                    if (primes.contains(start) && start != s && count > currentCount) {
                        currentCount = count;

                        if (start > stash) {
                            stash = start;
                        }
                    }

                    if (start >= limit) {
                        break;
                    }
                }
            }
        }

        System.out.println(stash);
    }