Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
6335 views
def simple_erato(n):#Fill in the blanks
    S=[] # S is a placeholder for primes <=k that will be removed
    L=[j for j in range(2,n+1)]# list of numbers <=n with L[0]=2; L will be changing
    k=? # Fact:for any composite number less or equal n there is a prime factor <=k
    while L[0]<=k:
        S.append(?) #Save the current prime in this list
        remove_multiple(?,L)
    return S+L
simple_erato(50)