All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Logic > Liars and Knights
Joe's favorite number (Posted on 2011-04-27) Difficulty: 3 of 5
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?

See The Solution Submitted by Math Man    
Rating: 4.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution analytic and computer solutions | Comment 2 of 4 |

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


 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
Please log in:
Remember me:
Sign up! | Forgot password

Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Copyright © 2002 - 2019 by Animus Pactum Consulting. All rights reserved. Privacy Information