private static int Decompose(int number, int previousIndex, List<Integer> primes, HashMap<String, Integer> memoized) {
        if (number == 1) {
            return 0;
        } else if (number == 0) {
            return 1;
        }

        int result = 0;
        for (int nextIndex = previousIndex; 0 <= nextIndex; nextIndex--) {
            Integer prime = primes.get(nextIndex);
            if (0 <= number - prime) {
                String key = (number - prime) + "+" + prime;
                Integer tempResult = memoized.get(key);
                if (tempResult == null) {
                    tempResult = Decompose(number - prime, nextIndex, primes, memoized);
                    memoized.put(key, tempResult);
                }
                result += tempResult;
            }
        }
        return result;
    }