C# Readable
\npublic static int NumPrimeArrangements(int n)\n        {\n            bool IsPrime(int num)\n            {\n                for (int i = 2; i <= num / 2; i++)
```\npublic static int NumPrimeArrangements(int n)\n        {\n            bool IsPrime(int num)\n            {\n                for (int i = 2; i <= num / 2; i++)\n                    if (num % i == 0)\n                        return false;\n\n                return true;\n            }\n\n            int mod = (int)Math.Pow(10, 9) + 7;\n\n            int count = 0;\n            for (int i = 2; i <= n; i++)\n                if (IsPrime(i))\n                    count++;\n\n            long res = 1;\n            for (int i = count; i > 0; i--)\n            {\n                res = (res * i) % mod;\n                res %= mod;\n            }\n\n            for (int i = n - count; i > 0; i--)\n            {\n\n                res = (res * i) % mod;\n                res %= mod;\n            }\n\n            return (int)res;\n        }\n```
[]