示例#1
0
def make_simple_pythagorean_triples(s_max):
    m_max = int(((2 * s_max + 1) ** 0.5 - 1) // 2)
    print(m_max)
    kk = [x for x in known_triples_300]
    out = []
    for m in range(2, m_max + 1):
        n_max_1 = int(s_max / m // 2) - m
        print(m, m % 2 + 1, n_max_1, 2 * m * (m + n_max_1))
        n_max = min(n_max_1, m - 1)
        for n in range(m % 2 + 1, n_max + 1, 2):
            if n > 1 and mylib.find_gcd(m,n) > 1:
                continue
            if n >= m:
                break
            # print(m, 'x', n, '/', m_max, 'x', n_max)
            x = m * m - n * n
            y = 2 * m * n
            z = m * m + n * n
            t = (min(x, y, ), max(x, y, ),z )

            if z <= 300:
                if t not in known_triples_300:
                    raise AssertionError('WTF', t)
                kk.remove(t)
            s = 2 * m * (m + n)
            out.append(s)
            print(m, n, t, s)
    if len(kk):
        raise AssertionError('WTF2', kk)
    return out
示例#2
0
m = 0
s = 2 * 3 * 5 * 7
for n in range(s, 1000, s):
    if mylib.is_prime(n):
        continue
    pd = mylib.find_dividers(n)
    if len(pd) < 4:
        continue
    dd = mylib.find_composite_dividers(n)
    print(n, len(dd), dd)
    ss = set()
    for a in dd:
        for b in dd:
            if b > a:
                continue
            if mylib.find_gcd(a, b) > 1:
                continue
            z = a + b
            x = round(n * z / b)
            y = round(n / a) * z
            print(a, b, x, y, x * y / (x + y))
            ss.add((min(x, y), max(
                x,
                y,
            )))

    sl = len(ss)
    if sl > m:
        m = sl
        print(n, sl, (len(mylib.find_composite_dividers((n**2))) + 1) / 2)
示例#3
0
    return out


m = 0
s = 2 * 3 * 5 * 7
for n in range(s, 1000, s):
    if mylib.is_prime(n):
        continue
    pd = mylib.find_dividers(n)
    if len(pd) < 4:
        continue
    dd = mylib.find_composite_dividers(n)
    print(n, len(dd), dd)
    ss = set()
    for a in dd:
        for b in dd:
            if b > a:
                continue
            if mylib.find_gcd(a, b) > 1:
                continue
            z = a + b
            x = round(n * z / b)
            y = round(n / a) * z
            print(a, b, x, y, x * y / (x + y))
            ss.add((min(x, y), max(x, y, )))

    sl = len(ss)
    if sl > m:
        m = sl
        print(n, sl, (len(mylib.find_composite_dividers((n ** 2))) + 1)/2)