Smallest Multiple
def smallest_multiple(n):
  """Calculates the smallest positive number that is divisible by all of the numbers from 1 to n"""

  import primefac
  
  l = []
  for i in xrange(2,n+1):   #calculating prime factorization of numbers <= n
    l.append(list(primefac.primefac(i)))
  print l
  
  l2=[]
  for i in xrange(len(l)):  #Turn list representation of prime factorization of each number into a dictionary representation
    dict2 = {}
    for j in l[i]:
      if j in dict2:
        dict2[j] += 1
      else:
        dict2[j] = 1
    l2.append(dict2)
  print l2
  
  l3=[]
  for i in xrange(len(l2)): #Turn the dictionary representation into tuple representation
    for j in l2[i]:
      l3.append((j, l2[i][j]))
  print l3
  l3.sort(key=lambda x: (x[0], x[1])) #sorting tuples, based on the first element, if they are equal sort based on the second element
  print l3
  
  for i in xrange(len(l3)-1): #e.x. 2^2 is subsumed in 2^3 so 2^2 must not be considered
    if l3[i][0] == l3[i+1][0] and l3[i][1] <= l3[i+1][1]:
      l3[i] = (1,1)
  print l3
  
  total = 1
  for i in xrange(len(l3)):
    total *= l3[i][0]**l3[i][1]
  return total