Python Solution | EASY 100%
\nclass Solution:\n    def numPrimeArrangements(self, n: int) -> int:\n        def factorial(n: int) -> int:\n            if n == 0:\n                return 1\n
```\nclass Solution:\n    def numPrimeArrangements(self, n: int) -> int:\n        def factorial(n: int) -> int:\n            if n == 0:\n                return 1\n            else:\n                return n * factorial(n - 1)\n\n        def is_prime(num):\n            if num < 2:\n                return False\n            for i in range(2, int(num ** 0.5) + 1):\n                if num % i == 0:\n                    return False\n            return True\n\n        pcount = 0\n        for num in range(1, n + 1):\n            if is_prime(num):\n                pcount += 1\n\n        return factorial(pcount) * factorial(n - pcount) % (10**9 + 7)\n```\n\n![image](https://assets.leetcode.com/users/images/56738745-a646-4e1a-bf1b-81d687205c30_1720657656.9161804.gif)\n
['Python', 'Python3']