[Python/Java] count primes
\'\'\'\nclass Solution:\n\n\t# Python 36 ms\n    def numPrimeArrangements(self, n):\n        def countprime(n):\n            A=[1](n+1)\n            A[0],A[1]=0
\'\'\'\nclass Solution:\n\n\t# Python 36 ms\n    def numPrimeArrangements(self, n):\n        def countprime(n):\n            A=[1]*(n+1)\n            A[0],A[1]=0,0\n            for i in range(2,int(n**0.5)+1):\n                if A[i]:\n                    A[i*i:n+1:i]=[0]*len(A[i*i:n+1:i])\n            return sum(A)\n        primes=countprime(n)\n        return (math.factorial(primes)*math.factorial(n-primes))%(10**9+7)\n\t\t\n\t# Java 0 ms\n\tpublic int numPrimeArrangements(int n) {\n        int primes=countprimes(n);\n        long res=1;\n        for (int j=1;j<=primes;j++)\n            res=(res*j)%1000000007;\n        for (int j=1;j<=n-primes;j++)\n            res=(res*j)%1000000007;\n        return (int)res;\n    }\n\n    public int countprimes(int n) {\n        int [] A=new int[n+1];\n        int primes=0;\n        Arrays.fill(A,1);\n        A[0]=0;A[1]=0;\n        for (int i=2;i*i<=n;i++){\n            if (A[i]==1){\n                for (int j=i*i;j<=n;j+=i){\n                    A[j]=0;\n                }\n            }\n        }\n        for (int i=0;i<=n;i++){\n            primes+=A[i];\n        }\n        return primes;\n    }\n\'\'\'
[]