Standard Java Solution
Theory \nWe need to find how many prime numbers there are from [1, N]. We also need to compute how many non-primes there are between [1, N], which can be derive
### Theory \nWe need to find how many prime numbers there are from [1, N]. We also need to compute how many non-primes there are between [1, N], which can be derived from `n - numPrimes = nonPrimes`. Then our answer will be `factorial(nonPrimes) * factorial(numPrimes)`.\n\n### Solution\n\n```\n    private static final int MOD = 1000000007;\n    public int numPrimeArrangements(int n) {\n        int primeCount = 0, nonPrimes = 0;\n        for (int i = 2; i <= n; i++) if(isPrime(i)) primeCount++;\n        nonPrimes = n - primeCount;\n        return (int) ((factorial(primeCount) * factorial(nonPrimes)) % MOD);       \n    }\n    \n    private boolean isPrime(int n) { \n        if (n <= 1) return false; \n        for (int i = 2; i <= Math.sqrt(n); i++) if (n % i == 0) return false; \n        return true; \n    }\n    \n    private long factorial(int x) {\n        long result = 1;\n        for (int i = x; i > 0; i--) result = ((i * result) % MOD);\n        return result;\n    }\n```\n
[]