code challenge: generate minimal expressions using only digits 1,2,3

Nigel Rantor wiggly at wiggly.org
Fri Feb 20 11:41:45 EST 2009


Trip Technician wrote:
> 
> yes n^n^n would be fine. agree it is connected to factorisation.
> building a tree of possible expressions is my next angle.

I think building trees of the possible expressions as a couple of other 
people have suggested is simply a more structured way of doing what 
you're currnetly doing.

Right now you're throwing darts at the problem space, and hoping that 
the next one point you hit will be a more optimal solution.

If you enumerate all the expression trees you are just ensuring you 
don't miss any solutions.

I think the algorithm/hueristic I just posted should get you to the 
answer quicker though...

   n



More information about the Python-list mailing list