A math wizard has a bag containing the digits 0 through 9, and has used six of them to stick two different three-digit perfect squares on the foreheads of Ann and Ben. Both Ann and Ben know this fact, but each person can see only the other person's number. The wizard asks Ann, "How many of the digits remaining in my bag can you exactly tell me?"
Ann replies, "Two."
Ben then says: "I know my number."
There are 3 possible 3-digit numbers on Ben's forehead. What are they?
clearvars,clc
squares=[];
for sr=10:31
sq=sr^2;
squares(end+1)=sq;
end
for i=1:length(squares)
whole='0123456789';
for j=1:length(squares)
tst=num2str(squares(i)*1000+squares(j));
if isequal(unique(tst,'stable'),tst)
disp([squares(i) squares(j)])
whole=setdiff(whole,tst);
end
end
if length(whole)<5
disp(whole)
disp(' ')
end
end
produces the below table of possible pairs of squares:
The first entry shows what the situation is when Ann sees Ben has 169.
She sees that regardless of whether she has 324 or 784, she knows that zero and 5 both remain in the bag as shown on the bottom line of that group.
Ben Ann
169 324
169 784
05
196 324
196 784
05
256 784
256 841
039
289 361
289 576
04
324 169
324 196
324 576
324 961
08
361 289
361 529
361 729
361 784
0
529 361
529 784
529 841
0
576 289
576 324
576 841
0
625 784
625 841
039
729 361
729 841
05
784 169
784 196
784 256
784 361
784 529
784 625
784 961
0
841 256
841 529
841 576
841 625
841 729
03
961 324
961 784
05
>>
Below are separated out, those cases where Ann could tell exactly two of the digits that remain in the wizards bag.
169 324
169 784
05
196 324
196 784
05
289 361
289 576
04
324 169 *
324 196 *
324 576
324 961
08
729 361
729 841 *
05
841 256 *
841 529 *
841 576
841 625 *
841 729 *
03
961 324
961 784
05
I've put an * against those cases where Ann's number (which Ben sees) uniquely identifies Ben's number to Ben. These have the values 324, 729, and 841 on Ben's forehead.
|
Posted by Charlie
on 2024-01-22 09:10:25 |