is_prime_number 0.1.0
is_prime_number: ^0.1.0 copied to clipboard
Prime numbers for Dart: a primality test that stays exact at 64 bits, a sieve, factorisation, and a lazy stream of primes. Pure Dart, no dependencies.
0.1.0 #
A real package rather than a single function.
Fixed
isPrimebounded the loop withsqrt(n).toInt().sqrtreturns a double, and one landing a hair under a perfect square truncated low — dropping the final divisor and reporting a composite as prime. The bound is nowi * i <= n, entirely in integers.- Large numbers were tested by trial division alone, which is unusable long
before
intruns out. Above 50,000 the test is now Miller–Rabin with a witness set proven deterministic across the wholeintrange. - The test file was the untouched
flutter createtemplate and did not compile — it referenced aCalculatorclass that never existed. There are now 24 tests. - The README documented
isPrimeNumber(...); the function isisPrime(...).
Changed
- Now a pure Dart package. It never used Flutter, and dropping the SDK dependency lets it run on the server, the web and the command line.
Added
nextPrime,previousPrime,nthPrimeprimesUpTo,primeCountUpTo— sieve of Eratosthenes over odds onlyprimes()— a lazy, infinite iterableprimeFactors,factorise,divisorsisPerfect,areTwinPrimes,isCoprime,gcd- An example, and documentation comments throughout
0.0.1 #
isPrime.