Блог пользователя Ahs_58

Автор Ahs_58, история, 6 лет назад, По-английски

Is there any way to find prime number upto 10^9 or more in 1 second?

  • Проголосовать: нравится
  • +13
  • Проголосовать: не нравится

»
6 лет назад, # |
Rev. 5   Проголосовать: нравится +30 Проголосовать: не нравится

Yes. It can be easily using Meisell-Lehmer algorithm to calculate the numbers of prime up to n in O(n^{2/3}).

or you can see F.Four Divisors.

»
6 лет назад, # |
Rev. 2   Проголосовать: нравится +8 Проголосовать: не нравится

If you want to enumerate all the primes upto 10^9 in 1 second, Segment Sieve of Eratosthenes plus Wheel Factorization will help a lot.

An example using primes 2, 3, 5, 7, 11, 13, code