I searched in the English dictionary the words that complete the alphametics
eleven + eleven = ?
in such a way that the solution is unique.
BTW - unique was one of the words that would fit!
There was a long list of potential candidates, so I decided to limit my choices by using only the letters that are not a part of the word eleven, e.g. circuit.
I leave it to you to find a non-esoteric word without any of the ELVN letters.
Enjoy!
clearvars,clc
digs='0123456789';
idx=combinator(10,4,'p');
codes=digs(idx);
i=1;
while i<length(codes)
code=codes(i,:);
if code(1)=='0'
codes(i,:)=[];
else
i=i+1;
end
end
% Now form:
% vList -- values of valid double elevens
% pList -- corresponding patterns (codes) for dbl eleven
% dList -- 1 if pattern is one of a duplicate (or multiple) set
% these lists are all the same length and refer to the
% same coding of ELEVEN.
vList=[]; pList=string.empty; dList=[];
% codes will be ordered lists of 4 digits
% representing e,l,v,n
lets='elvn'; ii=0;
for i=1:length(codes)
code=codes(i,:);
ns='eleven';
for j=1:4
ns=strrep(ns,lets(j),code(j));
end
n=str2double(ns);
v=2*n;
vs=char(string(v));
tst=setdiff(ns,vs);
% eleven + eleven must contain no digits from eleven
if length(tst)==4
ii=ii+1;
vList(ii)=v;
p=string(pttrn(vs));
if ismember(p,pList)
dList(find(pList==p))=1;
dList(ii)=1;
end
pList(ii)=p;
end
end
% create a list of patterns with unique numbers
% (if ELEVEN is unique then so is twice that value)
goodSubs=find(dList==0);
goodPats=pList(goodSubs);
ct=0;
fid=fopen('c:\words\words.txt','r');
while ~feof(fid)
w=fgetl(fid);
if (length(w)==6 || length(w)==7) ...
&& isequal(w,lower(w))
if length(setdiff('elvn',w))==4
if length(unique(w))<7
ct=ct+1;
codePat=pttrn(w);
if ismember(codePat,goodPats)
pf=goodPats==codePat;
sb=find(pf);
sb=goodSubs(sb);
matchNum=vList(sb);
fprintf('%s %d %d\n',w,matchNum,matchNum/2)
end
end
end
end
end
fclose('all');
function cd=pttrn(n)
rp='a';
ns=char(string(n));
repl=repmat(' ',1,length(ns));
for i=1:length(ns)
if repl(i)==' '
ix=strfind(ns,ns(i));
repl(ix)=rp;
rp=char(rp+1);
end
end
cd=repl;
end
finds the eligible words as well as the corresponding solutions. If you want to see only the words, they are shown below. I'll make a separate post that includes the corresponding solutions.
?
agitato
aoudads
babysat
bassist
bibasic
bogwood
bossism
boxwood
boyhood
catarrh
circuit
coactor
curacao
druidic
forsook
gigabit
ixodids
kabikis
mirrors
pothook
rattrap
tatouay
taxitic
thatchy
zamarro
|
Posted by Charlie
on 2023-09-06 13:48:31 |