Java Prime counts and Permutation formula
\n    public int numPrimeArrangements(int n) {\n        boolean[] p = new boolean[n + 1];\n        long cp = 0;\n        for (int i = 2; i <= n; i++) {\n       
```\n    public int numPrimeArrangements(int n) {\n        boolean[] p = new boolean[n + 1];\n        long cp = 0;\n        for (int i = 2; i <= n; i++) {\n            if(p[i]) continue;\n            cp++;\n            for (int j = 2; j * i <= n; j++) {\n                p[j * i] = true;\n            }\n        }\n        long cnp = n - cp, res = 1, mod = 1_000_000_007;\n        for (long cnt : new long[]{cp, cnp}){\n            for (long i = cnt; i >= 1; i--) {\n                res = res * i % mod;\n            }\n        }\n        return (int) res;   \n    }\n```
[]