static void makeSums(int tofix, int sumsofar, int sumdigits, int sumdigits2, long factor) {
        int rem = DIGITS - sumsofar;
        if (tofix == 0) {
            for (int i = 0; i <= rem; i++) {
                sofar[0] = i;
                makeSums(1, i, 0, 0, 1);
            }
        } else if (tofix == 9) {
            int sd = sumdigits + 9 * rem;
            int sd2 = sumdigits2 + 81 * rem;
            int newelem = MOD * sd + sd2;
            if (!sums.containsKey(newelem)) {
                sums.put(newelem, new long[DIGITS + 1]);
            }
            sums.get(newelem)[sofar[0]] += factors[DIGITS - sofar[0]] / (factor * factors[rem]);
            if (primes.contains(sd) && primes.contains(sd2)) {
                sumsPrime.add(newelem);
            }
        } else {
            for (int i = 0; i <= rem; i++) {
                sofar[tofix] = i;
                makeSums(tofix + 1, sumsofar + i, sumdigits + i * tofix, sumdigits2 + i * tofix * tofix, factor * factors[i]);
            }
        }
    }