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

Home > Logic
William's house-number (Posted on 2013-06-04) Difficulty: 3 of 5
William lives in a street with house-numbers 8 up to 100. Lisa wants to know at which number William lives.
She asks him: "Is your number larger than 50?"
William answers, but lies.
Upon this, Lisa asks: "Is your number a multiple of 4?"
William answers, but lies again.
Then Lisa asks: "Is your number a square?"
William answers truthfully.
Upon this, Lisa says: "I know your number if you tell me whether the first digit is a 3."
William answers, but now we don't know whether he lies or speaks the truth.
Thereupon, Lisa says at which number she thinks William lives, but (of course) she is wrong.

What is William's real house-number?

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer-assisted solution | Comment 2 of 5 |

We can assume that what led Lisa astray is her assumption that William was truthful in each answer. So first we should see what set of answers would lead Lisa to think that knowing whether the first digit was a 3 would settle the question of what number it is. For this to happen, the first three questions, when answered truthfully, would lead to two possibilities, one of which started with a 3 and the other of which did not.

DEFDBL A-Z
OPEN "williams.txt" FOR OUTPUT AS #2
FOR n = 8 TO 100
  IF n > 50 THEN PRINT #2, "y"; :  ELSE PRINT #2, "n";
  IF n MOD 4 = 0 THEN PRINT #2, "y"; :  ELSE PRINT #2, "n";
  sr = INT(SQR(n) + .5)
  IF sr * sr = n THEN PRINT #2, "y"; :  ELSE PRINT #2, "n";
  PRINT #2, USING "####"; n
NEXT
CLOSE

The above program determines the truthful answers to the questions for all the house numbers in the range given. The file was then sorted on those sets of answers (and a pair offset from the rest to show the specific pair):

nnn  10
nnn  11
nnn  13
nnn  14
nnn  15
nnn  17
nnn  18
nnn  19
nnn  21
nnn  22
nnn  23
nnn  26
nnn  27
nnn  29
nnn  30
nnn  31
nnn  33
nnn  34
nnn  35
nnn  37
nnn  38
nnn  39
nnn  41
nnn  42
nnn  43
nnn  45
nnn  46
nnn  47
nnn  50
nny   9
nny  25
nny  49
nyn   8
nyn  12
nyn  20
nyn  24
nyn  28
nyn  32
nyn  40
nyn  44
nyn  48

nyy  16
nyy  36

ynn  51
ynn  53
ynn  54
ynn  55
ynn  57
ynn  58
ynn  59
ynn  61
ynn  62
ynn  63
ynn  65
ynn  66
ynn  67
ynn  69
ynn  70
ynn  71
ynn  73
ynn  74
ynn  75
ynn  77
ynn  78
ynn  79
ynn  82
ynn  83
ynn  85
ynn  86
ynn  87
ynn  89
ynn  90
ynn  91
ynn  93
ynn  94
ynn  95
ynn  97
ynn  98
ynn  99
yny  81
yyn  52
yyn  56
yyn  60
yyn  68
yyn  72
yyn  76
yyn  80
yyn  84
yyn  88
yyn  92
yyn  96
yyy  64
yyy 100

Only the sequence No, Yes, Yes would lead Lisa to think she had the answer--either 16 or 36 depending on the answer to her fourth and last question, so those are the replies William gave to Lisa for the first three questions. 

Based on what we know about William's truthfulness, we know that the true answers were Yes, No and Yes, respectively. Only one number has that truthful set of answers: 81.

William lives at number 81.


  Posted by Charlie on 2013-06-04 11:40:43
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


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

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information