Python Seive + Maths
py\nclass Solution:\n    def numPrimeArrangements(self, n: int) -> int:\n        \n        table = [True] * (n+1)\n        count = 0\n        \n        for i in
```py\nclass Solution:\n    def numPrimeArrangements(self, n: int) -> int:\n        \n        table = [True] * (n+1)\n        count = 0\n        \n        for i in range(2, n+1):\n            if table[i] is True:\n                for i in range(i*i, n+1, i):\n                    table[i] = False\n                count += 1\n                \n\n        return (factorial(count)*factorial(n-count))%1000000007\n```
['Python']