def t_2(a_base, B, primes_list): clearfile(f"res/jae/2/{a_base}/spsp_{B}.txt") spsp = [] ### Посчет времени работы start_time = time.time() ### i = 1 for p in primes_list: if p < int(root(B, 2)): if p > a_base[-1]: lmd_p = Lambda_p(a_base, p) lmd = numth.lcm(lmd_p, 2) for k in range(int(1 + (p - 1) / lmd), int((B - p) / (p * lmd)) + 1, 1): q = 1 + k * lmd if p * q <= B: # and p * q > B // 100: if numth.is_prime(q) and q > p: if q + 1 == 2 * p: if check_signs(a_base, [p, q]) and psp_2( a_base, [p, q]): item = Signature(Sign(a_base, p), [p, q]) s = f"{i} {np.prod(item.primes)} {item.primes} {item.sign}\n" writefile( f"res/jae/2/{a_base}/spsp_{B}.txt", s) i += 1 spsp.append(item) else: continue else: P = p * (1 + k * lmd) if psp(a_base, P) and check_signs( a_base, [p, q]): item = Signature(Sign(a_base, p), [p, q]) s = f"{i} {np.prod(item.primes)} {item.primes} {item.sign}\n" writefile( f"res/jae/2/{a_base}/spsp_{B}.txt", s) i += 1 spsp.append(item) # else: # break ### total_time = "--- %s seconds ---\n" % (time.time() - start_time) ### writefile(f"res/jae/2/{a_base}/spsp_{B}.txt", total_time) return spsp
def Lambda_list(a_base, primes): lmd_list = [] for p in primes: lmd_list.append(Lambda_p(a_base, p)) lmd = numth.lcm(lmd_list) return lmd
def Lambda_p(a_base, p): ord_base = [] for a in a_base: ord_base.append(Ord(p, a)) lambda_p = numth.lcm(ord_base) return lambda_p