private double factorialsQuotient(final int[] dividends, final int[] divisors) {
        ArrayList<Integer> dividendFactors = new ArrayList<>();
        ArrayList<Integer> divisorFactors = new ArrayList<>();

        for (int n: dividends) {
           dividendFactors = mergeWithFactorialFactors(dividendFactors, n);
        }
        for (int n: divisors) {
            divisorFactors = mergeWithFactorialFactors(divisorFactors, n);
        }

        double dividend = 1.0;
        double divisor = 1.0;
        int dividendIdx = 0;
        int divisorIdx = 0;

        while (dividendIdx < dividendFactors.size() && divisorIdx < divisorFactors.size()) {
            if (dividendFactors.get(dividendIdx) < divisorFactors.get(divisorIdx)) {
                dividend *= dividendFactors.get(dividendIdx);
                ++dividendIdx;
            } else if (dividendFactors.get(dividendIdx) > divisorFactors.get(divisorIdx)) {
                divisor *= divisorFactors.get(divisorIdx);
                ++divisorIdx;
            } else {
                ++dividendIdx;
                ++divisorIdx;
            }
        }

        while (dividendIdx < dividendFactors.size()) {
            dividend *= dividendFactors.get(dividendIdx++);
        }
        while (divisorIdx < divisorFactors.size()) {
            divisor *= divisorFactors.get(divisorIdx++);
        }

        return dividend / divisor;
    }