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

Home > Logic > Liars and Knights
Who's Younger? (Posted on 2008-04-01) Difficulty: 3 of 5
Abby, Brenda, Carol, Diane and Emily are all of different ages. Two are liars and three are knights (knights always tell the truth; liars always lie).

Brenda claimed to be younger than Emily.
Carol claimed to be younger than Abby.
Carol claimed to be younger than Brenda.
Carol claimed to be younger than Diane.
Carol claimed to be younger than Emily.
Diane claimed to be younger than Brenda.
Diane claimed to be younger than Carol.
Diane claimed to be younger than Emily.
Emily claimed to be younger than Abby.
Emily claimed to be younger than Diane.

There were two other, similar, statements made, besides the ones metioned above, and in fact those were the only other statements like that that could be made.

That might be a little ambiguous, but resolving this ambiguity is part of the fun, and you can do it.

Who were the two liars and what was the order of their ages?

You can even fill in the two unheard remarks:

_______ claimed to be younger than _______
_______ claimed to be younger than _______

  Submitted by Charlie    
Rating: 3.0000 (2 votes)
Solution: (Hide)
There is an ambiguity in the question, as to whether a liar might be able to claim to be younger than herself, so the following program was written to find examples where there were 10 non-self-referential possible such claims (to which the two liars statements about themselves could be added to make 12), and examples where there were 12 non-self-referential claims like that.

After finding each combination of two liars out of five age positions that causes either 10 or 12 non-self-referential claims of "I am younger than x", the program goes through all 5! = 120 permutations of A through E being assigned to ages 1 through 5 (proxy for the unknown ages). When such an assignment matches the set of the 10 known statements, it is reported as the sequence of initials from youngest to oldest.

DECLARE SUB permute (a$)
CLS
FOR liar1 = 1 TO 4
FOR liar2 = liar1 + 1 TO 5
  ct = 0
  FOR x = 1 TO 5
  FOR y = 1 TO 5
    IF x <> y THEN
     IF x < y AND x <> liar1 AND x <> liar2 THEN ct = ct + 1
     IF x > y AND (x = liar1 OR x = liar2) THEN ct = ct + 1
    END IF
  NEXT
  NEXT
  PRINT liar1; liar2, ct
  IF ct = 10 OR ct = 12 THEN
    pr$ = ""
    FOR x = 1 TO 5
    FOR y = 1 TO 5
      IF x <> y THEN
       IF x < y AND x <> liar1 AND x <> liar2 OR x > y AND (x = liar1 OR x = liar2) THEN
        PRINT LTRIM$(STR$(x)); LTRIM$(STR$(y)); " ";
        pr$ = pr$ + LTRIM$(STR$(x)) + LTRIM$(STR$(y)) + " "
       END IF
      END IF
    NEXT
    NEXT
    PRINT
    a$ = "abcde": h$ = a$
    DO
      as$ = LTRIM$(STR$(INSTR(a$, "a")))
      bs$ = LTRIM$(STR$(INSTR(a$, "b")))
      cs$ = LTRIM$(STR$(INSTR(a$, "c")))
      ds$ = LTRIM$(STR$(INSTR(a$, "d")))
      es$ = LTRIM$(STR$(INSTR(a$, "e")))
      good = 1
      IF INSTR(pr$, bs$ + es$) = 0 THEN good = 0
      IF INSTR(pr$, cs$ + as$) = 0 THEN good = 0
      IF INSTR(pr$, cs$ + bs$) = 0 THEN good = 0
      IF INSTR(pr$, cs$ + ds$) = 0 THEN good = 0
      IF INSTR(pr$, cs$ + es$) = 0 THEN good = 0
      IF INSTR(pr$, ds$ + bs$) = 0 THEN good = 0
      IF INSTR(pr$, ds$ + cs$) = 0 THEN good = 0
      IF INSTR(pr$, ds$ + es$) = 0 THEN good = 0
      IF INSTR(pr$, es$ + as$) = 0 THEN good = 0
      IF INSTR(pr$, es$ + ds$) = 0 THEN good = 0
      IF good THEN PRINT a$
      permute a$
    LOOP UNTIL h$ = a$
  END IF
  PRINT
NEXT
NEXT



 1  2          4

 1  3          6

 1  4          8

 1  5          10
23 24 25 34 35 45 51 52 53 54

 2  3          8

 2  4          10
12 13 14 15 21 34 35 41 42 43

 2  5          12
12 13 14 15 21 34 35 45 51 52 53 54

 3  4          12
12 13 14 15 23 24 25 31 32 41 42 43
cebda

 3  5          14

 4  5          16

For example, the line 1 2   4 shows that if the youngest two were liars, only 4 statements of that form would be possible: 4 truthfully about 5, 3 truthfully about 4 and 5, and 2 falsely about 1.

In the cases where 10 such statements were possible, no assignment of names (letters) to digits would produce a set or subset that matched what was given.

The results also show that only one of the two sets of 12 statements works: only the sequence Carol (youngest), Emily, Brenda, Diane, Abby (oldest), with Brenda (3) and Diane (4) as the liars.

Emily's claiming to be younger than Brenda and Brenda's claim to be younger than Carol are the two statements that were left out of the puzzle clues, one true and one false.


Based on Enigma No. 1480, "Getting older", by Susan Denham, New Scientist, 9 February 2008.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
re(2): Puzzle AnswerK Sengupta2023-12-25 21:59:52
re: Puzzle AnswerK Sengupta2022-12-24 22:30:10
Puzzle AnswerK Sengupta2022-08-12 22:32:35
SolutionSolutionBrian Smith2008-04-02 22:27:45
re: I claim to be younger than myself (but I lie)ed bottemiller2008-04-02 16:48:09
SolutionI claim to be younger than myself (but I lie)Steve Herman2008-04-02 16:18:29
re(2): No ambiguity at alled bottemiller2008-04-02 10:54:33
re: No ambiguity at allCharlie2008-04-02 10:12:11
No ambiguity at alled bottemiller2008-04-01 17:44:47
SolutionI claim to be younger than Charlie (but I lie)Steve Herman2008-04-01 16:09:11
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (12)
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