A, B, C, and D represent four different digits that can be combined to yield 24 different four-digit integers.
These 24 integers have the following
properties:
- 4 are primes.
- 7 are the products of two different
odd primes.
- 1 is the square of a prime.
- 8 are divisible by 2 but not by 4.
- 2 are divisible by 4 but not by 8.
- 1 is divisible by 8 but not by 16
- 1 is divisible by 16.
Determine the values of A, B, C, and
D.
clearvars,clc
digs='1234567890';
idx=combinator(10,4,'c');
setsOf4=digs(idx);
for i=1:length(setsOf4)
s=setsOf4(i,:);
prms=perms(s);
for j=1:length(prms)
prm(j)=str2double(prms(j,:));
end
% prm(prm<1000)=[];
if length(prm)==24
pCt=length(prm(isprime(prm)));
if pCt==4
spCt=0; j=1;sqCt=0;
while j<=length(prm)
f=factor(prm(j));
if length(f)==2
if f(1)~=f(2)
if mod(f(1),2)==1 && mod(f(2),2)==1
spCt=spCt+1;
end
end
if f(1)==f(2)
sqCt=sqCt+1;
end
end
j=j+1;
end
if spCt==7 && sqCt==1
% disp(prm )
for j=1:length(prm)
ff=factor(prm(j));
fprintf('%4d %3d ',prm(j),length(ff))
fprintf('%d ',prm(j),ff)
if length(ff)==2
if ff(1)==ff(2)
fprintf('****')
end
end
fprintf('\n')
end
fprintf('\n')
end
end
end
end
uses only the first 3 properties to find the three digits are 1, 3, 4 and 8. Examination of the results show the other 4 criteria are also true:
4-digit number of prime
integers prime factors factors
8431 1 8431
8413 2 47 179 *
8341 2 19 439 *
8314 2 2 4157
8143 2 17 479 *
8134 4 2 7 7 83
4831 1 4831
4813 1 4813
4381 2 13 337 *
4318 3 2 17 127
4183 2 47 89 *
4138 2 2 2069
3841 2 23 167 *
3814 2 2 1907
3481 2 59 59 **** The perfect square
3418 2 2 1709
3184 5 2 2 2 2 199
3148 3 2 2 787
1843 2 19 97 *
1834 3 2 7 131
1483 1 1483
1438 2 2 719
1384 4 2 2 2 173
1348 3 2 2 337
A single asterisk marks the integers with 2 different odd prime factors. Primes of course have 1 prime factor.
|
Posted by Charlie
on 2024-12-29 10:08:35 |