About 177,000 results
Open links in new tab
  1. efficiently finding prime numbers in python - Stack Overflow

    Sep 28, 2017 · As we know 0,1 are not prime numbers, so we don't count them i.e (2,n+1) We take minimum element as prime and print it. Now, if 2 is prime, all of the multiples of 2 cannot …

  2. Print series of prime numbers in python - Stack Overflow

    When testing if X is prime, the algorithm doesn't have to check every number up to the square root of X, it only has to check the prime numbers up to the sqrt(X). Thus, it can be more …

  3. Is there a Python library to list primes? - Stack Overflow

    May 23, 2017 · Given an arbitrary integer N, the only way to find the next prime after N is to iterate through N+1 to the unknown prime P testing for primality. Testing for primality is very cheap, …

  4. python - Fastest way to list all primes below N - Stack Overflow

    Jan 15, 2010 · Fastest-in term of space- way to find prime numbers with python. 0. Optimizing Prime Number Python Code. 0.

  5. how to find a prime number function in python - Stack Overflow

    You know prime numbers can not be even, so you you dont have to check even numbers like 4-6-8-26. So in the range function, which is (2,number) add "2" end of it. like (3,number,2) then …

  6. Simple prime number generator in Python - Stack Overflow

    Mar 18, 2019 · primerange(a, b) # Generate a list of all prime numbers in the range [a, b). randprime(a, b) # Return a random prime number in the range [a, b). primepi(n) # Return the …

  7. To find first N prime numbers in python - Stack Overflow

    Whilst playing with prime numbers in Python V3 I noticed that the smallest number by which a composite(non-prime) number is divisible is itself always a prime that is less than the square …

  8. string - find prime numbers in python - Stack Overflow

    Jun 9, 2015 · >>> Prime(1,10) 1 is not a prime number 2 is a prime number 3 is a prime number 4 is divisible by 2 5 is a prime number 6 is divisible by 2, 3 7 is a prime number 8 is divisible by …

  9. checking prime number in python - Stack Overflow

    Jun 12, 2019 · In your loop, you print out a message that says "the number is prime" for each number that does not divide the given number. For example, if you want to check whether the …

  10. Python Finding Prime Factors - Stack Overflow

    This question was the first link that popped up when I googled "python prime factorization".As pointed out by @quangpn88, this algorithm is wrong (!) for perfect squares such as n = 4, 9, …

Refresh