Ad
Code
Diff
  • from math import sqrt
    
    def primemaker(x):
        if x < 2:
            return []
        else:
            primes = [2]
            for possible_prime in range(3, x+1, 2): #check only odd numbers
                limit = sqrt(possible_prime)
                for prime in primes:
                    if prime > limit:
                        primes.append(possible_prime)
                        break
                    if 0 == possible_prime % prime:
                        break
        return primes
    
    
    • from math import sqrt
    • def primemaker(x):
    • if x < 2:
    • return []
    • else:
    • primes = [2]
    • for possible_prime in range(3, x+1, 2): # check only odd numbers
    • for possible_prime in range(3, x+1, 2): #check only odd numbers
    • limit = sqrt(possible_prime)
    • for prime in primes:
    • if prime > limit:
    • primes.append(possible_prime)
    • break
    • if 0 == possible_prime % prime:
    • break
    • return primes
Code
Diff
  • public func holabro(){
      a=3
      return ""
    }
    • public func holabro(){
    • a=1
    • a=3
    • return ""
    • }

just trying how this works

public func holabro(){
  a=1
  return ""
}
Code
Diff
  • from math import sqrt
    
    def primemaker(x):
        primes = []
        if x < 2:
            return []
        else:  
            primes.append(2)
            for possible_prime in range(3,(x+1), 2): #only odd numbers
                limit = sqrt(possible_prime)
                for prime in primes:
                    if prime > limit:
                        primes.append(possible_prime)
                        break
                    if 0 == possible_prime % prime:
                        break
        return primes
    
    
    • from math import sqrt
    • def primemaker(x):
    • primes = []
    • if x < 2:
    • return []
    • else:
    • primes.append(2)
    • for possible_prime in range(3,(x+1), 2): # only odd numbers
    • for possible_prime in range(3,(x+1), 2): #only odd numbers
    • limit = sqrt(possible_prime)
    • for prime in primes:
    • if prime > limit:
    • primes.append(possible_prime)
    • break
    • if 0 == possible_prime % prime:
    • break
    • return primes