Can anyone write this program in python3 and explain the meaning of code please
ID: 3708287 • Letter: C
Question
Can anyone write this program in python3 and explain the meaning of code please ?
Thank you so much.
Write a program consecutive_primes.py that finds all sequences of 6 consecutive prime 5-digit numbers, say (a,b,c,d,e,f), with b = a + 2, c b+ 4, d = c + 6, e = d + 8, and f = e + 10, So a, b, c, d, e and f are all 5-digit prime numbers and no number between a and b, between b and c, between c and d, between d and e, and between e and f is prime. The expected output is: The solutions are: 13901 1390313907 13913 13921 1393:1 21557 21559 21563 21569 21577 21587 28277 28279 28283 28289 28297 28307 55661 55663 55667 55673 55681 55691 68897 68899 68903 6890968917 68927Explanation / Answer
def is_prime(number): if(number == 1): return False for x in range(2,number): if number%x == 0: return False return True end = 100000 start = 10001 for x in range(start,end,2): if(is_prime(x) and is_prime(x+2) and is_prime(x+6) and is_prime(x+12) and is_prime(x+20) and is_prime((x+30))): print(x,x+2,x+6,x+12,x+20,x+30)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.