Joe is either a knight, a liar, or a knave. His favorite number is an integer between 1 and 1000. He makes the following statements about his favorite number:
1. It is odd.
2. It is divisible by 7.
3. It is divisible by 23.
4. It is not divisible by 19.
5. It has an even number of divisors.
6. It ends in 9.
What type is Joe, and what is his favorite number?
If Joe were a knight and all the statements were true, then the number would be divisible by 7*23=161, which ends in a 1. The lowest multiple of 161 that would end in a 9 would be 161*9=1449, which is higher than the limit provided, so Joe is not a knight.
If Joe were a liar, so that all the statements would be false, the number would have to be even and divisible by 19, and thus by 38. In order to have an odd number of divisors, it would have to be a perfect square, so the smallest could be 38^2=1444, which is also above the limit of 1000.
So Joe is a knave. Statement 1 can't be false while 6 is true, so it must be the other way around. The number is odd and divisible by 23 and 19, but not by 7. 19*23=437, which indeed is not a perfect square, and so has an even number of divisors. Any larger odd multiple of 437 would be too large for the 1000 limitation.
So Joe is a knave whose favorite number is 437.
Of course, there's also the computer solution:
FOR n = 1 TO 1000
t1 = (n MOD 2 = 1)
t2 = (n MOD 7 = 0)
t3 = (n MOD 23 = 0)
t4 = (n MOD 19 <> 0)
sr = INT(SQR(n) + .5)
t5 = (sr * sr <> n)
t6 = (n MOD 10 = 9)
IF t1 = t3 AND t3 = t5 AND t2 = t4 AND t4 = t6 THEN
PRINT n, t1; t2; t3; t4; t5; t6
END IF
NEXT
giving
437 -1 0 -1 0 -1 0
where -1 represents true and 0 represents false.
|
Posted by Charlie
on 2011-04-27 14:00:18 |