You are reading a single comment by @wence and its replies.
Click here to read the full conversation.
-
Exponential algorithm?!?
I first parsed the problem as determining all simple paths in a digraph, so wrote the "obvious" thing (build the graph, call
networkx.all_simple_paths
). And then after waiting more than 30s I stopped and thought harder and did the next most obvious thing.[Edit: add what the original "obvious" thing was]
Exponential algorithm?!?
Mine runs fine given an input of every number from 1 to 73.
(Most will start to run into trouble given numbers 1 to 30 and it quickly gets uglier from then on.)
(Any more than 1..73 and the answer is > 2^64 and I can't be bothered to deal with that right now.)