0

I have already improved the lower bound of an unsolved problem in mathematics. However, I can improve the lower bound of others if I can access the 6-element subsets of $\{0, \ldots, 104\}$. I have to use python to run my current algorithm, so I am relying on itertools.combinations which is going to take 4 hours plus. I am wondering if there is an existing database that stores these combinations so we can access them in blazing fast time. If not, can we work on creating one?

Thank you.

Pig
  • 1
  • 1

1 Answers1

1

It is super easy to enumerate all such subsets. You don't need a database. It suffices to have 6 nested loops:

for i in range(105):
  for j in range(i+1,105):
    for k in range(j+1,105):
      for l in range(k+1,105:
        for m in range(l+1,105):
          for n in range(m+1,105):
            do_something(i,j,k,l,m,n)

If you want the maximum possible speed, implement in C rather than in Python, and learn about low-level optimizations.

D.W.
  • 167,959
  • 22
  • 232
  • 500