Java Easy
\nclass Solution \n{\n    public int numPrimeArrangements(int n) \n    {\n        int c_prime = prime_count(n);\n        \n        long r = 1;\n        for (int
```\nclass Solution \n{\n    public int numPrimeArrangements(int n) \n    {\n        int c_prime = prime_count(n);\n        \n        long r = 1;\n        for (int i = 2; i <= c_prime; ++i)\n        {\n            r = r * i;\n            r %= 1000000007;\n        }\n        for (int i = 2; i <= n - c_prime; ++i)\n        {\n            r = r * i;\n            r %= 1000000007;\n        }\n        \n        return (int) r;\n    }\n    \n    // find how many prime numbers in [1, n]\n    int prime_count(int n)\n    {\n        if (n < 2) return 0;\n        int count = 1;\n        for (int i = 3; i <= n; ++i)\n        {\n            boolean is_prime = true;\n            for (int j = 2; j * j <= i; ++j)\n            {\n                if (i % j == 0)\n                {\n                    is_prime = false;\n                    break;\n                }\n            }\n            if (is_prime) ++count;\n        }\n        \n        return count;\n    }\n}\n```
[]