Java Single mod-BigInteger
import java.math.BigInteger;\nclass Solution {\n    BigInteger mod=BigInteger.valueOf(1000000007);\n    public int numPrimeArrangements(int n) {\n        int pr
import java.math.BigInteger;\nclass Solution {\n    BigInteger mod=BigInteger.valueOf(1000000007);\n    public int numPrimeArrangements(int n) {\n        int prime=primeCount(n);\n        return ((fact(prime).multiply(fact(n-prime))).mod(mod)).intValue();\n    }\n    public int primeCount(int n){\n        int c=0;\n        for(int i=2;i<=n;i++){\n            if(i==2 || i==3 || i==5 || i==7 || i==11 || i==13 || i==17 || i==19 || i==23 || i== 29 || i==31 || i==37 || i== 41 || i==43 || i==47 || i==53 || i==59 || i==61 || i==67 || i==71 || i==73 || i==79 || i==83 || i==89 || i==97)\n                c++;\n        }\n        return c;\n    }\n    public BigInteger fact(int n){\n       BigInteger f=BigInteger.ONE;\n        for(int i=1;i<=n;i++)\n            f=f.multiply(BigInteger.valueOf(i));\n        return f;\n    }\n}
[]