mult = lambda_list[0] for i in range (1,len(lambda_list)): mult = lcm(mult,lambda_list[i]) return mult total=20000000 t0 = time.time() #get all primes first #primes_list = list(primes(total+1)) t1 = time.time() #print 'have sub-' + str(total+1) + ' primes: ' + str(t1-t0) #print primes_list powers_of_2_list = list(powers_of_2(total)) print len(powers_of_2_list) t2 = time.time() print 'have sub-' + str(total+1) + ' powers of 2: ' + str(t2-t1) #have one lambda list, shared by all calculations for Lsub #initialize the list with lambda(p**a) for a=1 #where we need lambda(p**a) for a>1, we will add these values as needed #lambda_list = [] #for i in primes_list: #lambda_list.append([carmichael_1fact(i,1)]) #lambda_list.append(carmichael_1fact(i,1)) t3 = time.time() print 'have ' + str(total+1) + ' lambda(p**1) values: ' + str(t3-t2) #print lambda_list t5 =t3
############ FIRST PASS to 1 million ######################################################################################### ######################################################################################### ######################################################################################### ######################################################################################### true_total = 20000000 total=1000000 t0 = time.time() #get all primes first #primes_list = list(primes(total+1)) t1 = time.time() #print 'have sub-' + str(total+1) + ' primes: ' + str(t1-t0) #print primes_list powers_of_2_list = list(powers_of_2(true_total)) #print len(powers_of_2_list) t2 = time.time() print 'have sub-' + str(total+1) + ' powers of 2: ' + str(t2-t1) #have one lambda list, shared by all calculations for Lsub #initialize the list with lambda(p**a) for a=1 #where we need lambda(p**a) for a>1, we will add these values as needed #lambda_list = [] #for i in primes_list: #lambda_list.append([carmichael_1fact(i,1)]) #lambda_list.append(carmichael_1fact(i,1)) t3 = time.time() print 'have ' + str(total+1) + ' lambda(p**1) values: ' + str(t3-t2) #print lambda_list t5 =t3