@Override
    public String getAnswer() throws Exception {

        /* Not gonna lie, I found the current solution from the forums and found it great
         * I left the old recursive calls below for reference.
         */

        int N = 13000;
        int[] minSum = new int[N];
        List<HashSet<Integer>> sums = new ArrayList<HashSet<Integer>>(N);

        for (int i = 2; i < N; i++) {
            sums.add(new HashSet<Integer>());
            sums.get(i-2).add(i-1);
            for (int j = (int) sqrt(i); j > 1; j--) {
                if (i % j == 0) {
                    for (int k : sums.get(i/j -2)) {
                        int s = j - 1 + k;
                        if (i - s >= 2 && minSum[i - s] == 0)
                            minSum[i - s] = i;
                        sums.get(i-2).add(j - 1 + k);
                    }
                }
            }
        }

        Set<Integer> unique = new HashSet<Integer>(12000);
        int sum = 0;
        for (int i = 0;i<=12000; i++) {
            if (!unique.contains(minSum[i])) {
                unique.add(minSum[i]);
                sum+=minSum[i];
            }
        }
        return Integer.toString(sum);
    }