C# faster than 100%, less than 100% Mem, O(n)
Runtime: 32 ms\nMemory Usage: 14.8 MB\n\n```\n    public int NumPrimeArrangements(int n) {\n        int primeCount = CountOfPrimes(n);\n        int otherCount =
Runtime: 32 ms\nMemory Usage: 14.8 MB\n\n```\n    public int NumPrimeArrangements(int n) {\n        int primeCount = CountOfPrimes(n);\n        int otherCount = n - primeCount;\n        \n        long result = 1;\n        int mod = (int)Math.Pow(10,9) + 7;\n        \n        while(otherCount > 0)\n        {\n            result *= otherCount;\n            if (result > mod)\n            {   result = result % mod; }\n            otherCount--;\n        }\n        \n        while(primeCount > 0)\n        {\n            result *= primeCount;\n            if (result > mod)\n            {   result = result % mod; }\n            primeCount--;\n        }\n        \n        return (int)result;\n    }\n    \n    private int CountOfPrimes(int n)\n    {\n        int[] primes = new int[n+1];\n        int count = 0;\n        for(int i=2; i<= n; i++)\n        {\n            if (primes[i] != 0) { continue; }\n            count++;\n            \n            for(int j=i; j<= n; j+=i)\n            {\n                primes[j] = -1;\n            }\n        }\n        \n        return count;\n    }
[]