def divisible(n): """ Returns the smallest number that is divisible by all numbers from 1 to n. :type n: int :rtype : int """ factors = tools.sieve(n) for i in range(0, len(factors)): p = factors[i] while p * factors[i] <= n: p = p * factors[i] factors[i] = p ans = 1 for p in factors: assert isinstance(p, int) ans *= p return ans
__author__ = 'hooda' import tools # This is why python is awesome! print(sum(tools.sieve(2000000)))
def f(x): print((tools.sieve(x))[10000])