On Tuesday, October 8, 2002, at 11:18  PM, Chris Devers wrote

> On a different note, last weekend on NPR there was a puzzle that it 
> seems
> to me could be solved pretty neatly by a Perl script, and I'm curious
> what solutions people would try for it. Consider the following string:
>
>     1 2 3 4 5 6 7 8 9    =    2002
>
> The problem is to add any number of addition & multiplication 
> operations
> wherever you'd like on the left such that in the end you have a valid
> equation.

Do you have to keep the digits in the same order?

If so, there are only 3^8=6561 solutions to try.  Between each digit you
can have +, *, or nothing.

_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to