Prime Arrangements - JS - fastest solution
\nvar numPrimeArrangements = function(n) {\n    a = 0, b = 0, res = 1\n    mod = 10 ** 9 + 7\n\n    for (let i = 1; i <= n; i++) {\n        res *= isPrime(i) ? 
```\nvar numPrimeArrangements = function(n) {\n    a = 0, b = 0, res = 1\n    mod = 10 ** 9 + 7\n\n    for (let i = 1; i <= n; i++) {\n        res *= isPrime(i) ? ++a : ++b\n        res = res % mod\n    }\n\n    return res\n\n    function isPrime (num) {\n        s = Math.sqrt(num)\n\n        for (let i = 2; i <= s; i++) {\n            if (num % i == 0) return false\n        }\n\n        return num > 1\n    }\n\n};\n```
['JavaScript']