public static List<Integer> binomialCongruence(final int n, int a, final int m) {
        positiveCheck(n);
        positiveCheck(m);
        a = normalizeIntModulo(a, m);
        if (m == 1)
            return new ArrayList<>(Arrays.asList(0, 1));
        if (n == 1) {
            final Pair<Integer, Integer> linear = linearCongruence(1, a, m);
            return new ArrayList<>(Arrays.asList(linear.getFirst(), linear.getSecond()));
        }
        if (n == 2)
            return quadraticCongruenceSimple(a, m);
        
        int maxNumberOfSolutions = m;
        if ((isCoprime(a, m)) && (primitiveRootsExist(m))) {
            final int phiM = eulerPhi(m);
            final int d = gcd(n, phiM);
            if (modPow(a, phiM / d, m) != 1)
                return new ArrayList<>();
            maxNumberOfSolutions = d;
        }
        return binomialCongruenceSolve(n, a, m, maxNumberOfSolutions);
    }