Python simple and fast solution
\nclass Solution:\n    def numPrimeArrangements(self, n: int) -> int:\n        return (math.factorial(self.count_primes(n)) * math.factorial(n - self.count_prim
```\nclass Solution:\n    def numPrimeArrangements(self, n: int) -> int:\n        return (math.factorial(self.count_primes(n)) * math.factorial(n - self.count_primes(n))) % (10**9 + 7)\n        \n    def prime(self, num):\n        if num == 1:\n            return False\n        for i in range(2, int(math.sqrt(num)) + 1):\n            if num % i == 0:\n                return False\n        return True\n    \n    def count_primes(self, n):\n        res = 0\n        for i in range(1, n+1):\n            if self.prime(i):\n                res += 1\n        return res\n```\n
[]