Esempio n. 1
0
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
Esempio n. 2
0
__author__ = 'hooda'

import tools

# This is why python is awesome!
print(sum(tools.sieve(2000000)))
Esempio n. 3
0
def f(x):
    print((tools.sieve(x))[10000])