@@ -0,0 +1,965 @@
+# coding: utf-8%0Afrom collections import defaultdict%0Aimport factors as fs%0A%0A%0Aclass NthNumbersDistribution(object):%0A    def __init__(self, n):%0A        self.ffs = %5Bfs.factor(x) for x in xrange(n)%5D%0A%0A    def max_factorization_len(self):%0A        max_factorization_len = max(len(fs) for fs in self.ffs)%0A        return max_factorization_len%0A%0A    def longest_factorizations(self):%0A        lfs = list(fs for fs in self.ffs%0A                      if len(fs) == self.max_factorization_len())%0A        return lfs%0A%0A    def nth_nr_dist(self):%0A        cntr = defaultdict(int)%0A        lffs = map(len, self.ffs)%0A        for l in lffs:%0A            cntr%5Bl%5D += 1%0A        return cntr%0A%0A    def nth_nrs(self, nth):%0A        nnrs = %5B%5D%0A        for fs in self.nth_factors(nth):%0A            product = reduce(lambda a, b: a * b, fs, 1)%0A            nnrs.append(product)%0A        return nnrs%0A%0A    def nth_factors(self, nth):%0A        nfs = %5Bfs for fs in self.ffs if len(fs) == nth%5D%0A        return nfs%0A%0A

factorize series of numbers