About 134,000 results
Open links in new tab
  1. Print series of prime numbers in python - Stack Overflow

    The best way to solve the above problem would be to use the "Miller Rabin Primality Test" algorithm. It uses a probabilistic approach to find if a number is prime or not. And it is by-far …

  2. Simple prime number generator in Python - Stack Overflow

    Mar 18, 2019 · import math import itertools def create_prime_iterator(rfrom, rto): """Create iterator of prime numbers in range [rfrom, rto]""" prefix = [2] if rfrom < 3 and rto > 1 else [] # include 2 if …

  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. checking prime number in python - Stack Overflow

    Jun 12, 2019 · i wrote this program to check weather the no. is prime or not but it shows the number is prime multiple times. how can i solve it To check weather the number is prime or not.

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

    So in the range function, which is (2,number) add "2" end of it. like (3,number,2) then program will not check even numbers. ALSO a factor can not be bigger than that numbers square root. So …

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

    Jan 15, 2010 · Nonetheless this is my suggestion for a pure python prime sieve, based on omitting the multiples of 2, 3 and 5 by using appropriate steps while processing the sieve …

  7. Python Beginner's Loop (Finding Primes) - Stack Overflow

    You know 2 is the only even prime number, so you add 2 in your list and start from 3 incrementing your number to be checked by 2. Once you are past the half-way point (see above sqrt and * …

  8. primes - isPrime Function for Python Language - Stack Overflow

    Mar 8, 2013 · Consider the prime number 5003: print is_prime(5003) Prints: 5 11 17 23 29 35 41 47 53 59 65 True The line r = int(n**0.5) evaluates to 70 (the square root of 5003 is …

  9. python - How can I use a for loop to check whether any value …

    I was tasked with writing a program that asks for a positive integer n as input and outputs True if n is a prime number and False otherwise.

  10. efficiently finding prime numbers in python - Stack Overflow

    Sep 28, 2017 · you only need to check division by all previous primes in the list to find whether a number is prime. is prime flag should be set before second loop. n is the number that you want …

Refresh