Exemple #1
0
 def find_by_k(self):
     """
     a = 3k - 1
     b = k
     c = 8 * k - 3
     :return:
     """
     self.triplets = []
     for bk in range(1, self.get_max_q()):
         ck = (8 * bk - 3)
         ak = 3 * bk - 1
         sq_d = self.get_square_dividers(ck)
         if ak + bk + ck > self.limit:
             if mylib.is_prime(ck) and not len(sq_d):
                 continue
         m0 = mylib.mult(sq_d)
         b0 = bk * m0
         c0 = int(ck / m0 / m0)
         if c0 > self.limit - ak - 1:
             continue
         b_limit = self.limit - ak - c0
         bm_bm = [(x, int(b0 / x)**2)
                  for x in mylib.find_composite_dividers(b0, b_limit)]
         for bm in bm_bm:
             b = bm[0]
             c = c0 * bm[1]
             if ak + b + c > self.limit:
                 continue
             t = [ak, b, c]
             self.triplets.append(t)
             print(t, len(self.triplets))
         continue
     return self
Exemple #2
0
 def find_by_k(self):
     """
     a = 3k - 1
     b = k
     c = 8 * k - 3
     :return:
     """
     self.triplets = []
     for bk in range(1, self.get_max_q()):
         ck = (8 * bk - 3)
         ak = 3 * bk - 1
         sq_d = self.get_square_dividers(ck)
         if ak + bk + ck > self.limit:
             if mylib.is_prime(ck) and not len(sq_d):
                 continue
         m0 = mylib.mult(sq_d)
         b0 = bk * m0
         c0 = int(ck / m0 / m0)
         if c0 > self.limit - ak - 1:
             continue
         b_limit = self.limit - ak - c0
         bm_bm = [(x, int(b0 / x) ** 2) for x in mylib.find_composite_dividers(b0, b_limit)]
         for bm in bm_bm:
             b = bm[0]
             c = c0 * bm[1]
             if ak + b + c > self.limit:
                 continue
             t = [ak, b, c]
             self.triplets.append(t)
             print(t, len(self.triplets))
         continue
     return self
Exemple #3
0
        if x < 2:
            continue
        ee += mylib.find_dividers(x)
    # print("+", sorted(out),"\n-", sorted(ee))
    for x in ee:
        if x in out:
            ix = out.index(x)
            out = out[:ix] + out[ix + 1 :]
    return tuple(sorted(out))


def binom_list(n):
    return [binom_c(n, x) for x in range(n // 2 + 1)]


def binom_list_dd(n):
    return [binom_dd(n, x) for x in range(n // 2 + 1)]


r = set()
for i in range(51):
    for j in range(i // 2 + 1):
        dd = binom_dd(i, j)
        dd_distinct = tuple(sorted(set(dd)))
        if len(dd) == len(dd_distinct):
            a = mylib.mult(dd)
            r.add(a)
            print(i, j, a, dd, len(r))

print(sum(r), sorted(r))
Exemple #4
0
	def test_mult_simple(self):
		self.assertEqual(mylib.mult(8,3), 25)
Exemple #5
0
        if x < 2:
            continue
        ee += mylib.find_dividers(x)
    # print("+", sorted(out),"\n-", sorted(ee))
    for x in ee:
        if x in out:
            ix = out.index(x)
            out = out[:ix] + out[ix + 1:]
    return tuple(sorted(out))


def binom_list(n):
    return [binom_c(n, x) for x in range(n // 2 + 1)]


def binom_list_dd(n):
    return [binom_dd(n, x) for x in range(n // 2 + 1)]


r = set()
for i in range(51):
    for j in range(i // 2 + 1):
        dd = binom_dd(i, j)
        dd_distinct = tuple(sorted(set(dd)))
        if len(dd) == len(dd_distinct):
            a = mylib.mult(dd)
            r.add(a)
            print(i, j, a, dd, len(r))

print(sum(r), sorted(r))