public static BigInteger GetPrimeCount(BigInteger minval, BigInteger maxval) { BigInteger count; if (maxval < minval) { throw new Exception("maxval < minval"); } if (minval < Consts.BI2P64) { if (maxval < Consts.BI2P64) { count = Prime53.GetPrimeCount(Common.ToULong(minval), Common.ToULong(maxval), () => Ground.IsStopped() == false); } else { count = Prime53.GetPrimeCount(Common.ToULong(minval), ulong.MaxValue, () => Ground.IsStopped() == false); count += GetPrimeCount_BIBI(Consts.BI2P64, maxval, rate => 0.5 + rate * 0.5); } } else { count = GetPrimeCount_BIBI(minval, maxval, rate => rate); } return(count); }