javaScript
\nvar numPrimeArrangements = function(n) {\n    let primes = 0;\n    let all = new Array(n).fill(2);\n    for (let i = 2; i <= n; i++) {\n        if (all[i - 1]
```\nvar numPrimeArrangements = function(n) {\n    let primes = 0;\n    let all = new Array(n).fill(2);\n    for (let i = 2; i <= n; i++) {\n        if (all[i - 1] === 2) {\n            primes += 1;\n        };\n        for (let k = 2; k < n; k++) {\n            if (!all[i * k - 1]) {\n                break;\n            };\n            all[i * k - 1] = 1;\n        };\n    };\n    all = all.length - primes;\n    let result = 1;\n    let modulo = 10 ** 9 + 7;\n    for (let i = 1; i <= primes; i++) {\n        result = (result * i) % modulo;\n    };\n    for (let i = 1; i <= all; i++) {\n        result = (result * i) % modulo;\n    };\n    return result;\n};\n```
[]