java easy solution || count primes and nonprimes|| runtime 0ms
\nclass Solution {\n    public int numPrimeArrangements(int n) {\n        int nonPrime=1;\n        boolean[] arr=new boolean[n+1];\n        Arrays.fill(arr,true
```\nclass Solution {\n    public int numPrimeArrangements(int n) {\n        int nonPrime=1;\n        boolean[] arr=new boolean[n+1];\n        Arrays.fill(arr,true);\n        for(int i=2;i*i<=n;i++)\n        {\n            for(int j=i*2;j<=n;j+=i)\n            {\n                if(arr[j]==true)\n                {\n                    arr[j]=false;\n                    nonPrime++;\n                }\n            }\n        }\n        long res=1;\n        int prime=n-nonPrime;\n        for(int i=prime;i>0;i--)\n        {\n            res*=i;\n            res%=1000000007;\n        }\n        for(int i=nonPrime;i>0;i--)\n        {\n            res*=i;\n            res%=1000000007;\n        }\n        return (int)res;\n    }\n}\n```
['Java']