Simple Java With comment [sieve_of_eratosthenes]
Used sieve of eratosthenes to generate count prime no \n\n    public static int countPrimes(int n) {\n        boolean[] prime = new boolean[n + 1];\n        Arr
Used sieve of eratosthenes to generate count prime no \n```\n    public static int countPrimes(int n) {\n        boolean[] prime = new boolean[n + 1];\n        Arrays.fill(prime, 2, n + 1, true);\n        for (int i = 2; i * i <= n; i++)\n            if (prime[i])\n                for (int j = i * i; j <= n; j += i)\n                    prime[j] = false;\n        int cnt = 0;\n        for (int i = 0; i < prime.length; i++)\n            if (prime[i])\n               cnt++;\n\n        return cnt;\n    }\n```\nif you dont know what is sieve of eratosthenes read this\nhttps://www.geeksforgeeks.org/sieve-of-eratosthenes/\n\nAfter getting count of prime \'pn\'\ncalculate no fo arragement of prime numbers i.e pn!\ncalculate no fo arragement of non-prime numbers i.e (n-pn)!\n\nafterwards simple multiply them I used BigInteger of java\n\nHope you will like it :P\n```\n\n    static int MOD = 1000000007;\n\n    public static int numPrimeArrangements(int n) {\n        int noOfPrime = generatePrimes(n);\n        BigInteger x = factorial(noOfPrime);\n        BigInteger y = factorial(n - noOfPrime);\n        return x.multiply(y).mod(BigInteger.valueOf(MOD)).intValue();\n    }\n\n    public static BigInteger factorial(int n) {\n        BigInteger fac = BigInteger.ONE;\n        for (int i = 2; i <= n; i++) {\n            fac = fac.multiply(BigInteger.valueOf(i));\n        }\n        return fac.mod(BigInteger.valueOf(MOD));\n    }\n```\n\n
['Java']