JavaScript Dynamic Programming and BigInt()
js\nvar numPrimeArrangements = function(n) {\n    let count = 0;\n    const MOD = BigInt(1e9 + 7);\n    const factorials = [1n]\n    for(let i=1; i<=n; i++) fac
```js\nvar numPrimeArrangements = function(n) {\n    let count = 0;\n    const MOD = BigInt(1e9 + 7);\n    const factorials = [1n]\n    for(let i=1; i<=n; i++) factorials[i] = BigInt(factorials[i-1]*BigInt(i)%MOD);\n    \n    function isPrime(m){\n        for(let i=2; i*i<=m; i++){\n            if(m%i === 0) return false;\n        }\n        return true;\n    }\n    \n    for(let i=2; i<=n; i++){\n        count += isPrime(i)\n    }\n    \n    return factorials[count]*factorials[n-count]%(MOD);\n};\n```
[]