Determine all the numbers formed by three different and non-zero digits, such that the six numbers obtained by
permuting these digits leaves the same remainder after the division by 4.
nset=combinator(9,3,'c');
for i=1:length(nset)
nsubset=nset(i,:);
idx=combinator(3,3,'p');
nsubset=num2str(nsubset(idx));
for j=1:size(nsubset,1)
v(j,:)=erase(nsubset(j,:),' ');
v2(j)=str2double(v(j,:));
r(j)=mod(str2double(v(j,:)),4);
end
if length(unique(r))==1
disp(v2)
disp(mod(v2,4))
end
end
finds
>> permutationsAndRemainders
951 915 591 519 159 195
3 3 3 3 3 3
>>
|
Posted by Charlie
on 2024-05-17 13:10:26 |