= numbers set(range(num, 1, -1)) # all numbers in range (sorted backwards) primes [] start_time = time. time ( ) while n

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

= numbers set(range(num, 1, -1)) # all numbers in range (sorted backwards) primes [] start_time = time. time ( ) while n

Post by answerhappygod »

Numbers Set Range Num 1 1 All Numbers In Range Sorted Backwards Primes Start Time Time Time While N 1
Numbers Set Range Num 1 1 All Numbers In Range Sorted Backwards Primes Start Time Time Time While N 1 (52.48 KiB) Viewed 24 times
= numbers set(range(num, 1, -1)) # all numbers in range (sorted backwards) primes [] start_time = time. time ( ) while numbers: p = numbers.pop() # p = the last element in the numbers list primes.append(p) # p add p to the primes list numbers.difference_update(set(range(p*2, num+1, p))) # {numbers} - {(p*2 -> num+1) incremented by p}
for n in range( lower, num + 1): if n > 1: for i in range(2, n): if (n % i) == 0: break else: count +=1 =
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply