示例#1
0
def probleme49(L):
    r = set(str(L[0]))
    for i in L:
        if not r == set(str(i)): return False
        if not mt.is_prime(i): return False
        r = set(str(i))
    return True
示例#2
0
def testquadratic(a, b, affi=False):
    n = 0
    while True:
        r = (n**2) + (a * n) + b
        #print(r)
        if r < 0: return n, r
        elif not mt.is_prime(r):
            return n, r
        if affi: print(r)
        n += 1
示例#3
0
def num_prime(n):
    z = 1 / (10**n)
    a = 1
    m = 0, 0
    while True:
        r = 2
        L = []
        while True:
            s = a**(2**r)
            if not mt.is_prime(floor(s)): break
            L.append(floor(s))
            r += 1
        if m[0] < r - 2: m = r - 2, a, L
        a += z
        a = round(a, n)
        if a >= 2: return m
示例#4
0
def minimal(base):
    minimal = []
    for i in mt.minimal(mt.primegenfast(), base, limit=base**3):
        minimal.append(i)
    familytest = []
    last_digits = minimal_last_digits(base)
    digits = minimal_digits(base)
    for x in digits[1:]:
        for z in last_digits:
            Y = [
                dig for dig in digits if not any(
                    is_subsequence(
                        num,
                        str_base(x, base) + str_base(dig, base) +
                        str_base(z, base), base) for num in minimal)
            ]
            if Y:
                familytest.append(Family(x, Y, z, base=base))
    familytest = list(filter(lambda x: x.contain_prime(), familytest))
    i = 0
    while familytest:
        new = []
        for family in familytest:
            new += family.lemma19()
        familytest = new[:]
        new = []
        for family in familytest:
            w = family(0, True)
            if subword_in_minimal(w, minimal, base): pass
            elif mt.is_prime(w):
                minimal.append(w)
            else:
                new += family.lemma21(minimal, 1)

        familytest = new[:]
        new = []
        #print(familytest)
        for family in familytest:
            new += family.lemma23(minimal)
        familytest = new[:]
        familytest = list(filter(lambda x: x.contain_prime(), familytest))
        if i % 10 == 0: print(familytest)
        i += 1
    return minimal
示例#5
0
 def contain_prime(self):
     if self.is_num(): return mt.is_prime(self(0, True))
     return not (1 < mt.gcd(*self(1, True), self(0, True)) < self(0, True))