All answers must contain the string
2023:
1. What is the smallest number written exactly with 7 digits?
2. What is the smallest integer using 11 digits i.e. all digits 0 to 9 and an extra digit 2?
3. Write down the smallest square s.t. each digit is present at least once.
4. Evaluate the quadruplet {a,b,c,d} of distinct non-negative integers, s.t. a*b+c+d=2023 and abcd is minimal.
The 1st solver is kindly requested to post at least 2 answers out of the set of four.
1. 1002023 is the first such that has 2023 in it.
2. 12023456789 is the first such that has 2023 in it.
3. The smallest square s.t. each digit is present at least once is 32043^2 = 1026753849, but the smallest such that contains the string 2023 is 440684^2 = 194202387856.
from
flag=false;
for i=1:9999999
sq=char(string(i^2));
if isequal(unique(sq),'0123456789')
if flag==false || ~isempty(strfind(sq,'2023'))
disp([char(string(i)) ' ' sq])
flag=true;
if ~isempty(strfind(sq,'2023'))
break
end
end
end
end
4. {a, b, c, d} = {21, 96, 0, 7} gives
21 * 96 + 0 + 7 = 2023
clearvars,clc
mn=99999999999999;
for a=1:2023
for b=a+1:2023/a
r=2023-a*b;
for c=0:r
if c~=a && c~=b
d=2023-a*b-c;
if d>0 && d~=a && d~=b && d~=c
abcd=str2double([char(string(a)) char(string(b)) ...
char(string(c)) char(string(d)) ]);
if abcd<mn
mn=abcd
mina=a
minb=b
minc=c
mind=d
end
end
end
end
end
end
... also run with a larger than b, but that results in a higher abcd concatenation.
|
Posted by Charlie
on 2022-12-28 08:51:38 |