Ask Question
4 February, 03:49

Produce a list named primes which only contains the central number of two twin primes in the range [2,1000]. (A twin prime is a prime number which has another prime number two away from it, like 41 and 43; in this case, we would add the number 42 to our list.) We provide a function is_prime to assist you with this. Call it like this: is_prime (5).

+1
Answers (1)
  1. 4 February, 04:53
    0
    def is_prime (x):

    for i in range (2, x):

    if x%i==0:

    return False

    return True

    primes=[]

    for i in range (2,1001):

    # print (i, is_prime (i), is_prime (i+2))

    if is_prime (i) and is_prime (i+2):

    primes. append (i+1)

    print (primes)
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Produce a list named primes which only contains the central number of two twin primes in the range [2,1000]. (A twin prime is a prime ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers