The product of 722*227 (163,894) contains neither 2 nor 7.
List all the couples (b,c; b>c) such that the product bcc*ccb contains neither b nor c.
Bonus: From the above list select couples, if any, using none of the corresponding digits in the partial products as well.
for c=1:8
for b=c+1:9
bcc=100*b+11*c;
ccb=110*c+b;
p=num2str(bcc*ccb);
good=true;
for i=1:strlength(p)
if str2num(p(i))==b || str2num(p(i))==c
good=false;
break
end
end
if good
disp([c b bcc ccb bcc*ccb])
end
end
end
disp(" ")
for b=1:8
for c=b+1:9
bcc=100*b+11*c;
ccb=110*c+b;
p=num2str(bcc*ccb);
good=true;
for i=1:strlength(p)
if str2num(p(i))==b || str2num(p(i))==c
good=false;
break
end
end
if good
disp([c b bcc ccb bcc*ccb])
end
end
end
For problem as presented:
c b bcc cbb bcc*cbb
2 3 322 223 71806
2 7 722 227 163894
4 7 744 447 332568
5 8 855 558 477090
6 7 766 667 510922
For c>b (not in original problem):
5 2 255 552 140760
7 3 377 773 291421
7 4 477 774 369198
7 6 677 776 525352
|
Posted by Charlie
on 2020-11-28 12:30:37 |