Find the number of ways in which the nine digits 1,2,3,...,9 can be arranged in a 3*3 square array such that the determinant of this square is an odd integer. Each digit to be used only once.
(In reply to
Computer Solution by Larry)
aSet=perms(1:9);
oddCt=0; mlist=[];
for i=1:length(aSet)
a=reshape(aSet(i,:),[3 3]);
if mod(det(a),2)==1
oddCt=oddCt+1;
mlist(end+1)=det(a);
end
end
oddCt
mlist=sort(mlist);
[mlist(1) mlist(end)]
length(unique(mlist))
does get -407 and 407 as the smallest and largest odd determinant, but gets 381 as the count of unique determinants and 108585 as the count of all the determinants.
|
Posted by Charlie
on 2024-05-29 15:58:09 |