using BigInt in dart and making the fastest solution in dart
\n# Complexity\n- Time complexity:\n O(n * sqrt(n))\n- Space complexity:\n O(1)\n# Code\n\nclass Solution {\n  static const int MOD = 1000000007;\n\n  int numPr
\n# Complexity\n- Time complexity:\n O(n * sqrt(n))\n- Space complexity:\n O(1)\n# Code\n```\nclass Solution {\n  static const int MOD = 1000000007;\n\n  int numPrimeArrangements(int n) {\n    int primeCount = countPrimes(n);\n    int nonPrimeCount = n - primeCount;\n\n    BigInt primePermutations = calculatePermutations(primeCount);\n    BigInt nonPrimePermutations = calculatePermutations(nonPrimeCount);\n\n    BigInt result = (primePermutations * nonPrimePermutations) % BigInt.from(MOD);\n    \n    return result.toInt();\n  }\n\n  int countPrimes(int n) {\n    int count = 0;\n    for (int i = 1; i <= n; i++) {\n      if (isPrime(i)) {\n        count++;\n      }\n    }\n    return count;\n  }\n\n  bool isPrime(int num) {\n    if (num <= 1) {\n      return false;\n    }\n    if (num == 2) {\n      return true;\n    }\n    if (num % 2 == 0) {\n      return false;\n    }\n    for (int i = 3; i * i <= num; i += 2) {\n      if (num % i == 0) {\n        return false;\n      }\n    }\n    return true;\n  }\n\n  BigInt calculatePermutations(int count) {\n    BigInt result = BigInt.from(1);\n    for (int i = 1; i <= count; i++) {\n      result = (result * BigInt.from(i)) % BigInt.from(MOD);\n    }\n    return result;\n  }\n}\n\n```
['Dart']