C++ Simple Solution (beats all)
\nclass Solution {\n    int mod=1e9+7;\n    int nop(int n) {\n        int c=0, flag=false;\n        for(int i=2; i<=n; i++) {\n            for(int j=2; j*j<=i; 
```\nclass Solution {\n    int mod=1e9+7;\n    int nop(int n) {\n        int c=0, flag=false;\n        for(int i=2; i<=n; i++) {\n            for(int j=2; j*j<=i; j++) {\n                if(i%j==0) {\n                    flag = true;\n                    break;\n                }\n            }\n            if(!flag)\n                c++;\n            else\n                flag=false;\n        }\n        return c;\n    }\n    long long fact(int n) {\n        if(n==0)\n            return 1;\n        return n*fact(n-1)%mod;\n    }\npublic:\n    int numPrimeArrangements(int n) {\n        int p = nop(n);\n        int c = n-p;\n        long long x = fact(p)%mod*fact(c)%mod;\n        return x%mod;\n    }\n};\n```
['C']