Exemplo n.º 1
0
def filter_seq(seq):
    """Examines unreserved sequences to see if they are prone to mutation. This
     currently ignores solely-power-of-2 guides with b > 3"""
    if seq.res:
        return None
    n = nt.Factors(seq.factors)
    guide, s, t = aq.canonical_form(n)
    seq.guide = guide
    # The target_tau for the composite is at most the class minus extant prime factor count
    cls = aq.get_class(guide=guide)
    num_larges = seq.factors.count("P")
    upper_bound_tau = cls - num_larges - len(t)

    if cls < 2 or upper_bound_tau < 2:  # Cheap tests to eliminate almost all sequences
        return None

    # Next we ignore sequences whose guide is solely a power of 2 greater than 3
    v = nt.Factors({p: a for p, a in guide.items() if p != 2 and a > 0})
    if int(v) == 1 and cls > 3:
        return None
    # This condition greatly reduces fdb load, but excludes a lot of sequences
    if not aq.is_driver(guide=guide):
        return None

    return n, guide
Exemplo n.º 2
0
def guide(string):
    """Returns a tuple of (str_of_guide, class_with_powers, is_driver)"""
    if "terminated" in string:
        return "Terminated?", -9, True
    elif "Garbage" in string:
        return "Garbage", -9, False
    else:
        dr = get_guide(string, powers=False)  # dr is an instance of "Factors"
        drs = str(dr)  # str specified by "Factors" class
        if drs == "2":
            return "Downdriver!", 1, False
        else:
            return drs, get_class(string), is_driver(guide=dr)