C++ 7 line 0ms
```\n    int numPrimeArrangements(int n) {\n        static const vector primes = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};   \n 
```\n    int numPrimeArrangements(int n) {\n        static const vector<int> primes = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};   \n        const int k = upper_bound(primes.begin(), primes.end(), n) - primes.begin();\n        const auto mod = (long long)1e9 + 7;\n        long long res = 1;\n        for(int i = 2; i<=k; i++) {res*=i; res%=mod;}\n        for(int i = 2; i<=n-k; i++) {res*=i; res%=mod;}\n        return res;\n    }
[]