Beispiel #1
0
def main():
  pents = [n for n in geometry.pent_numbers(10000)]
  for j in xrange(len(pents) - 1):
    for k in xrange(j + 1, len(pents)):
      psum = pents[j] + pents[k]
      pdiff = pents[k] - pents[j]
      if utils.list_has(pents, psum) and utils.list_has(pents, pdiff):
        print abs(pdiff)
        print (pents[j], pents[k], psum, pdiff)
Beispiel #2
0
def main():
  # tris = [n for n in geometry.triangle_numbers(50000)]
  pents = [n for n in geometry.pent_numbers(50000)]
  hexs = [n for n in geometry.hex_numbers(50000)]

  for tri_n in geometry.triangle_numbers():
    if utils.list_has(pents, tri_n) and utils.list_has(hexs, tri_n): # fast binary-search
    # if tri_n in pents and tri_n in hexs:               # old slow approach
      if tri_n > 40755:
        print tri_n
        break