def cfs(): c = 1 vals = [] while c < 10000: vals.append(count_factors(c)) c += 1 return vals
def factor_search(m=1000): c = 0 n = 1 highest = (1, 1) while c < m: c = count_factors(n) n += 10 if c > highest[0]: highest = (c, n) print n-1
def solve(m=1000): count = 0 c = 0 n = 245044800 step = -2520 vals = [] highest = (0,1) while count < m: c = count_factors(n) #solutions(n) # if c > highest[0]: # highest = (c, n) if c > 1000: print "%i\t%i" % (c, n)# highest #if count % 10==0: print n, n += step count += 1 return vals
i = 1 s = 0 while True: s = s + i i += 1 yield s ## demo #c=0 #for x in tris(): # if c >= 7: # break # print '%2i: %s' % (x, ','.join(map(str, [f for f in factors(x)]))) # c+=1 m = 0 n = 1 t = tris() while m < 500: c = t.next() m = max(m, count_factors(c)) n+=1 if n % 200==0: print n print '%2i: %s' % (c, ','.join(map(str, [f for f in factors(c)]))) # 11800 # 12000 # 12200 #76576500
c = 1 vals = [] while c < 10000: vals.append(count_factors(c)) c += 1 return vals def sols(): c = 1 vals = [] while c < 10000: vals.append(solutions(c)) c += 1 return vals s = time.time() sols() print "solutions in", time.time() - s s = time.time() cfs() print "count factors in", time.time() - s else: m = 10000 v = dict((n, solutions(n)) for n in range(1, m+1)) v2 = dict((n, count_factors(n)) for n in range(1,m+1)) for i in v: if v[i] != v2[i]: print '%-4i: %-3i%i' % (i, v[i], v2[i]) print ' ', ','.join(map(str, [f for f in factors(i)])) print ' ', ','.join(map(str, [f for f in psolutions(i)]))