Kernel: Python 3 (Ubuntu Linux)
In [1]:
In [2]:
The following is a terrible function being recursive. Running through the n element subsets requires rebuilding all the m element subsets for m < n. A dynamical algorithm or memoization needs to be used, but at the expense of a huge memory cost.
A better, bounded search algorithm should be looked for here.
In [3]:
In [4]:
In [5]:
In [6]:
In [7]:
In [8]:
No 1 element solution
No 2 element solution
No 3 element solution
No 4 element solution
No 5 element solution
/usr/local/lib/python3.6/dist-packages/ipykernel/__main__.py:2: RuntimeWarning: invalid value encountered in true_divide
from ipykernel import kernelapp as app
/usr/local/lib/python3.6/dist-packages/ipykernel/__main__.py:3: RuntimeWarning: invalid value encountered in true_divide
app.launch_new_instance()
No 6 element solution
No 7 element solution
No 8 element solution
In [ ]: