x 7 x
____________
x x) x x x x x
x 7 7
----------
x 7 x
x 7 x
---------
x x
x x
-----
In this skeletal division problem:
- Each of the x's denote a digit from 0 to 9, whether same or different.
- None of the x's denote the digit 7
- None of the numbers can contain a leading zero.
Complete the above-mentioned division.
clearvars, clc
for q=[170:979]
qs=char(string(q));
for dvsr=10:99
dvdnd=q*dvsr;
dvdnds=char(string(dvdnd));
if dvdnd>=10000
if dvdnd<=99999 && qs(2)=='7'
part1=floor(dvdnd/100);
tst=dvsr*floor(q/100);
diff=part1-tst;
if mod(tst,100)==77 && tst>100 && diff<100 && diff>10 && mod(diff,10)==7
if isempty(strfind(dvdnds,'7') )
disp([q dvsr dvdnd])
end
end
end
end
end
end
giving
970 53 51410
971 53 51463
narrows it down to just two possibilities, so further programming wasn't called for:
Either
___970
53 ) 51410
or
___971
53 ) 51463
So, working both out:
___970
53 )51410
477
371
371
00 leading zero (but understandably so)
no other line
___971
53 )51463 This is the solution.
477
376
371
53
53
Edited on June 18, 2022, 9:39 am
|
Posted by Charlie
on 2022-06-18 09:36:30 |