clearvars,clc
solnSet=[]
ival=zeros(1,10);
alpha='u+go*an==gigg';
ltrs='ugoani';
num1=nchoosek('0123456789',6);
for i=1:length(num1)
num2=perms(num1(i,:));
for j=1:length(num2)
nums=num2(j,:);
eq=alpha;
for k=1:6
eq=strrep(eq,ltrs(k),nums(k));
end
if eval(eq)==true
ival(str2num(eq(end-2))+1)=ival(str2num(eq(end-2))+1)+1;
disp(eq)
solnSet=[solnSet ; eq ];
end
end
end
solnSet=sortrows(solnSet,11);
disp(' ')
disp(solnSet)
finds the solution set (grouped by value of I):
3+14*72==1011
3+12*84==1011
4+19*53==1011
3+18*56==1011
8+17*59==1011
2+47*86==4044
9+36*84==3033
7+34*89==3033
8+04*23==0100
6+02*47==0100
8+02*46==0100
5+34*92==3133
3+56*92==5155
5+29*73==2122
8+03*64==0200
7+14*86==1211
5+18*67==1211
6+07*42==0300
0+27*86==2322
6+15*87==1311
1+67*95==6366
0+17*83==1411 <-< I=4 has this unique solution
8+07*56==0400 if leading zeros are not allowed
2+06*83==0500
4+08*62==0500
0+26*97==2522
0+67*98==6566
7+16*94==1511 <-< Of the I=5 solutions, this one beomes
unique if 0 by itself is disallowed also
0+17*83==1411
U GO AN GIGG
234 8688
NI A AA
Trying if not even zero by itself is allowed:
7+16*94==1511
U GO AN GIGG
234 8688
N O
but still no sensible solution. Perhaps we could add fitting letters other than U, G, O, A, G, and I to the unassigned digits.
Added:
I see in previous comments the name KEN DODD. That fits the situation where no leading zeros are allowed; even zero by itself is disallowed and the alphametic solution is 7+16*94=1511.
Edited on March 31, 2022, 11:45 am
|
Posted by Charlie
on 2022-03-31 11:32:22 |