public static List<Integer> elementsOfUnitGroup(final int n) {
        notLessThanCheck(n, 2);
        final List<Integer> result = new ArrayList<>();
        if (isPrime(n)) {
            for (int i = 1; i < n; ++i)
                result.add(i);
        } else {
            for (int i = 1; i < n; ++i)
                if (isCoprime(i, n))
                    result.add(i);
        }
        return result;
    }