Some years ago I wrote a routine that looked for all the solutions to this
type of game with the substitution of all the digits and the operators
("*","+","-","/") in the Integers.
"Doubly True" is the name of this game If I remember well...
A brute approach in this case helps:
In[1]:= <<DiscreteMath`Combinatorica`
In[2]:=
s=ToUpperCase["but*ask==feast"]
s2=StringCases[s,LetterCharacter];
unicChs=Union[Flatten[Characters[ToUpperCase[s2]]]];
l=Length[unicChs];
digs=CharacterRange["0","9"];
p=Take[digs,l];
ks=p;
Do[
Do[
test=StringReplace[s,Thread[unicChs->p]];
If[ToExpression[test],Print[test]];
p=NextPermutation[p],
{l!}];
ks=NextKSubset[digs,ks];
p=ks,
{Binomial[10,l]}];
Well formed solutions:
160*283==45280
630*124==78120
670*142==95140
540*128==69120
165*439==72435
Bye,
~Scout~
"Bruce Colletti" <vze269bv at verizon.net>
news:ejc4pv$6nf$1 at smc.vnet.net...
> How would this problem be solved in Mathematica?
>
> BUT * ASK = FEAST, where each letter is a 1-digit number, no two letters
> may stand for the same number, and the letters are in {0,1,2,4,5,6,7,9}.
>
> Thankx.
>
> Bruce
>