di(9).Īn obvious way to improve is by performing the tests as early as possible, merging them with the generatorsĪnd move the computation of S+E+N+D and M+O+R+E as far up as possible. Why is it so slow? It is a generate-and-test solution that first does all the generation, 10^8 (or 100 million)ĭi(S), di(E), di(N), di(D), di(M), di(O), di(R), di(Y), I didn't run it to the end, but it looks correct. It has been made a little more readable by adding empty lines and simplifying the final equality check. The first solution was provided by an anonymous on SWISH. Each letter mustb be replaced by a unique digit and the addition This example solves the famous puzzle below.
0 Comments
Leave a Reply. |